package com.handinfo.uimenu.window;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import java.util.TimeZone;
import java.util.Vector;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.handinfo.engine.AbstractGameScreen;
import com.handinfo.engine.Actor;
import com.handinfo.engine.Animation;
import com.handinfo.engine.GameManager;
import com.handinfo.engine.resource.ObjectAdapter;
import com.handinfo.engine.resource.ResHead;
import com.handinfo.engine.resource.ResourceManager;
import com.handinfo.game.ActorItem;
import com.handinfo.game.ActorItemFomula;
import com.handinfo.game.GameItem;
import com.handinfo.uimenu.UIAbstractWindow;
import com.handinfo.uimenu.UIListener;
import com.handinfo.uimenu.UIManager;
import com.handinfo.uimenu.UIMessageBox;
import com.handinfo.uimenu.UIPalette;
import com.handinfo.uimenu.UITools;
import com.handinfo.uimenu.UIWindowFactory;
import com.handinfo.util.ArrayList;
import com.handinfo.util.Tools;
import com.test.touch.GameTouchManager;

public class UICaveWorldWindow extends UIAbstractWindow
{
	public UICaveWorldWindow(int id)
	{
		super(id);
		initImage();
		setBounds(UITools.X_BG, UITools.Y_BG, UITools.W_BG, UITools.H_BG);
	}

	protected void paintContent(Graphics g)
	{
		UITools.clearScreen(g); // 清屏
		// 绘制背景
		UITools.paintBackGround(g, m_x, m_y, m_w, m_h, "洞府");
		// 绘制标题标签
		drawDongFuLabel(g);
		//绘制*#
//		int imgw = UIManager.IMAGE_LABEL_ARR.getWidth();
//		int LABEL_CHANGE1_X = m_x + ((m_w - UITools.W_BUTTON_BIG * DONGFU_LABEL_PAGE) >> 1) - imgw;
//		int LABEL_CHANGE2_X = m_x + ((m_w + UITools.W_BUTTON_BIG * DONGFU_LABEL_PAGE) >> 1);
//		if (DONGFU_UI_CURRENT == DONGFU_UIMAIN) {
//			if (m_dongfu_label_currentindex == 0) {
//				UITools.paintLabelArr(g, LABEL_CHANGE1_X, UITools.Y_BUTTON, true, false);
//				UITools.paintLabelArr(g, LABEL_CHANGE2_X, UITools.Y_BUTTON, false, true);
//			}
//			else if (m_dongfu_label_currentindex == (m_openDongFuLableNUm - 1)) {
//				UITools.paintLabelArr(g, LABEL_CHANGE1_X, UITools.Y_BUTTON, true, true);
//				UITools.paintLabelArr(g, LABEL_CHANGE2_X, UITools.Y_BUTTON, false, false);
//			}
//			else {
//				UITools.paintLabelArr(g, LABEL_CHANGE1_X, UITools.Y_BUTTON, true, true);
//				UITools.paintLabelArr(g, LABEL_CHANGE2_X, UITools.Y_BUTTON, false, true);
//			}
//		}
		if (m_openDongFuLable == null || m_openDongFuLable.size() == 0) {
			return;
		}
		byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
		switch (DONGFU_UI_CURRENT) {
			case DONGFU_UIMAIN:
				g.setClip(m_background_fill_x, m_background_fill_y, m_background_fill_w, m_background_fill_h);
				UITools.drawListFrame(g, m_background_fill_x, m_background_fill_y,
						m_background_fill_w, m_background_fill_h);
				g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
				UITools.drawListFrame(g, FRAME_ANIM_X, FRAME_ANIM_Y, FRAME_ANIM_W, FRAME_ANIM_H);
				int tempW = img_border_jiao.getWidth();
				int tempH = img_border_jiao.getHeight();
				g.drawRegion(img_border_jiao, 0, 0, tempW, tempH, 3, FRAME_ANIM_X + 2, FRAME_ANIM_Y + 2, 0);
				g.drawRegion(img_border_jiao, 0, 0, tempW, tempH, 0, FRAME_ANIM_X + FRAME_ANIM_W - 2, FRAME_ANIM_Y
						+ FRAME_ANIM_H - 2, Tools.RIGHT_BOTTOM);
				g.drawRegion(img_border_jiao, 0, 0, tempW, tempH, 1, FRAME_ANIM_X + FRAME_ANIM_W - 2, FRAME_ANIM_Y + 2,
						Tools.RIGHT_TOP);
				g.drawRegion(img_border_jiao, 0, 0, tempW, tempH, 2, FRAME_ANIM_X + 2, FRAME_ANIM_Y
						+ FRAME_ANIM_H - 2, Tools.LEFT_BOTTOM);
				switch (itemNum) {
					case DONGFU_LABEL_YQS:
						if (m_dongfu_yqs_status == -1) {
							drawNotOpen(g);
						}
						else {
							drawDongFuYQS(g);
						}
						break;
					case DONGFU_LABEL_JBP:
						if (m_dongfu_jbp_status == -1) {
							drawNotOpenJBP(g);
						}
						else {
							drawDongFuJBP(g);
						}
						break;
					case DONGFU_LABEL_BGL:
						if (m_dongfu_bgl_status == -1) {
							drawNotOpen(g);
						}
						else {
							drawDongFuBGL(g);
						}
						break;
					case DONGFU_LABEL_TGF:
						if (m_dongfu_tgf_status == -1) {
							drawNotOpen(g);
						}
						else {
							drawDongFuTGF(g);
						}
						break;
				}
				break;
			case DONGFU_UIPEIFANG:
				switch (itemNum) {
					case DONGFU_LABEL_YQS:
						drawDongWateringList(g, m_wateringList, "帮忙好友");
						break;
					case DONGFU_LABEL_JBP:
						drawDongFuPeiFang(g, m_dongfu_jbp_peifang_list, "投入宝物", true);
						if (m_dongfu_jbp_peifang_list == null || m_dongfu_jbp_peifang_list.size() == 0) {
							g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_WIDTH);
							g.drawString("您没有可使用的材料。", m_x + (m_w >> 1), m_y + (m_h >> 1), Tools.HCENTER_TOP);
						}
						break;
					case DONGFU_LABEL_BGL:
						drawDongFuPeiFang(g, m_dongfu_bgl_peifang_list, "选择太极方", true);
						if (m_dongfu_bgl_peifang_list == null || m_dongfu_bgl_peifang_list.size() == 0) {
							g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_WIDTH);
							g.drawString("您没有可使用的配方。", m_x + (m_w >> 1), m_y + (m_h >> 1), Tools.HCENTER_TOP);
						}
						break;
					case DONGFU_LABEL_TGF:
						drawDongFuPeiFang(g, m_dongfu_tgf_peifang_list, "选择天工图", false);
						if (m_dongfu_tgf_peifang_list == null || m_dongfu_tgf_peifang_list.size() == 0) {
							g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_WIDTH);
							g.drawString("您没有可使用的配方。", m_x + (m_w >> 1), m_y + (m_h >> 1), Tools.HCENTER_TOP);
						}
						break;
				}
				break;
			case DONGFU_UISTUFF:
				switch (itemNum) {
					case DONGFU_LABEL_JBP:
						drawDongFuGongFaMSG(g); //查看攻伐信息
						break;
					case DONGFU_LABEL_BGL:
						drawDongFuStuff(g, m_dongfu_need_Prop, "炼制", "份");
						break;
					case DONGFU_LABEL_TGF:
						drawDongFuStuff(g, m_dongfu_need_Prop, "锻造", "件");
						break;
				}
				break;
//			case DONGFU_UISTART:
//				switch (m_dongfu_label_currentindex) {
//					case DONGFU_LABEL_JBP:
//						break;
//					case DONGFU_LABEL_BGL:
//						drawDongFuStartMake(g, "炼制", "份");
//						break;
//					case DONGFU_LABEL_TGF:
//						drawDongFuStartMake(g, "锻造", "件");
//						break;
//				}
//				break;
			case DONGFU_UIADDSPEED:
				drawDongFuPeiFang(g, m_dongfu_add_speedList, "加速"
						+ DONGFU_LABEL[itemNum], true);
				break;
		}
	}

	protected void keyLogic()
	{
		switch (DONGFU_UI_CURRENT) {
			case DONGFU_UIMAIN:
				logicMain();
				break;
			case DONGFU_UIPEIFANG:
				logicPeiFang();
				break;
			case DONGFU_UISTUFF:
				logicStuff();
				break;
//			case DONGFU_UISTART:
//				logicStart();
//				break;
			case DONGFU_UIADDSPEED:
				logicADDSpeed();
				break;
		}
		if (m_dongfu_jbp_isStart) {
			if (--m_dongfu_jbp_time < 0) {
				m_dongfu_jbp_isStart = false;
				m_dongfu_jbp_time = 0;
				m_dongfu_jbp_status = 2;
				actor_jbp.setAction(2, true, true);
			}
		}
		if (m_dongfu_bgl_isStart) {
			if (--m_dongfu_bgl_time < 0) {
				m_dongfu_bgl_isStart = false;
				m_dongfu_bgl_time = 0;
				m_dongfu_bgl_status = 2;
			}
		}
		if (m_dongfu_tgf_isStart) {
			if (--m_dongfu_tgf_time < 0) {
				m_dongfu_tgf_isStart = false;
				m_dongfu_tgf_time = 0;
				m_dongfu_tgf_status = 2;
			}
		}
		if (m_dongfu_jbpbaohu_isStart) {
			if (--m_jbp_baohushengyu_time < 0) {
				m_dongfu_jbpbaohu_isStart = false;
				m_jbp_baohushengyu_time = 0;
			}
		}
	}

	private boolean m_dongfu_jbpbaohu_isStart = false;

	private boolean m_dongfu_jbp_isStart = false;
	private int m_dongfu_jbp_time = 0;
	private boolean m_dongfu_bgl_isStart = false;
	private int m_dongfu_bgl_time = 0;
	private boolean m_dongfu_tgf_isStart = false;
	private int m_dongfu_tgf_time = 0;

	/***
	 * 洞府倒计时
	 * 
	 * @param time
	 */
	public void startDongFuJBPTime(boolean status, int time)
	{
		m_dongfu_jbp_isStart = status;
		m_dongfu_jbp_time = time;
	}

	public void startDongFuBGLTime(boolean status, int time)
	{
		m_dongfu_bgl_isStart = true;
		m_dongfu_bgl_time = time;
	}

	public void startDongFuTGFTime(boolean status, int time)
	{
		m_dongfu_tgf_isStart = true;
		m_dongfu_tgf_time = time;
	}

	public void startDongfuJBPBaohuTime(boolean status)
	{
		m_dongfu_jbpbaohu_isStart = status;
	}

	// public void endDongFuTime()
	// {
	// m_dongfu_isStart = false;
	// m_dongfu_time = 0;
	// }
	private void logicADDSpeed()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
				|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			if (m_dongfu_add_speedList == null
					|| m_dongfu_add_speedList.size() == 0) {
				return;
			}
			GameManager.getInstance().m_game_message
					.sendDongFuADDSpeed(getADDSpeedPropID(m_dongfu_add_speedList));
			DONGFU_UI_CURRENT = DONGFU_UIMAIN;
		}
		else if (AbstractGameScreen
				.haveKeyPressed(AbstractGameScreen.GK_UP)) {
			if (m_dongfu_peifang_currentindex > 0) {
				m_dongfu_peifang_currentindex--;
			}
		}
		else if (AbstractGameScreen
				.haveKeyPressed(AbstractGameScreen.GK_DOWN)) {
			if (m_dongfu_peifang_currentindex < (m_dongfu_add_speedList.size() - 1)) {
				m_dongfu_peifang_currentindex++;
			}

		}
		else if (AbstractGameScreen
				.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			DONGFU_UI_CURRENT = DONGFU_UIMAIN; // 返回主界面
		}
	}

	private void logicStart()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
				|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			if (m_need_prodction < 1) {
				GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "生产的数量必须大于0");
				return;
			}
			byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
			GameManager.getInstance().m_game_message.sendDongFuStartProduction(
					itemNum, m_current_map_key, m_need_prodction);
		}
		else if (AbstractGameScreen
				.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			DONGFU_UI_CURRENT = DONGFU_UIMAIN; // 返回主界面
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_UP)) {
			if (m_index_dongfu_start > 0) {
				m_index_dongfu_start -= m_peifangstart_num;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_DOWN)) {
			if (m_index_dongfu_start + m_peifangstart_num <= m_dongfu_need_Prop.size() - 1) {
				m_index_dongfu_start += m_peifangstart_num;
			}
		}
	}

	/**
	 * 材料界面监听
	 */
	private void logicStuff()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
				|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
//			switch (m_dongfu_label_currentindex) {
//				case DONGFU_LABEL_JBP:
//					DONGFU_UI_CURRENT = DONGFU_UISTART;
//					break;
//				case DONGFU_LABEL_BGL:
//					DONGFU_UI_CURRENT = DONGFU_UISTART;
//					break;
//				case DONGFU_LABEL_TGF:
//					DONGFU_UI_CURRENT = DONGFU_UISTART;
//					break;
//			}
//			if (m_StuffIsEnough) {
			if (true) {
				byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
				GameManager.getInstance().m_game_message.sendDongFuStartProduction(
						itemNum, m_current_map_key, m_need_prodction);
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			DONGFU_UI_CURRENT = DONGFU_UIMAIN; // 返回主界面
		}
//		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT)) {
//			if (m_need_prodction > 1) {
//				m_need_prodction--;
//			}
//		}
//		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT)) {
//			if (m_need_prodction < m_max_prodctionNum) {
//				m_need_prodction++;
//			}
//		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_UP)) {
			if (m_index_dongfu_peifang > 0) {
				m_index_dongfu_peifang -= m_peifang_num;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_DOWN)) {
			if (m_index_dongfu_peifang + m_peifang_num <= m_dongfu_need_Prop.size() - 1) {
				m_index_dongfu_peifang += m_peifang_num;
			}
		}
	}

	private String m_current_map_key;

	/**
	 * 配方按键监听
	 */
	private void logicPeiFang()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
				|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
			// 发送配方key
			switch (itemNum) {
				case DONGFU_LABEL_YQS:
					break;
				case DONGFU_LABEL_JBP:
					if (m_dongfu_jbp_peifang_list == null
							|| m_dongfu_jbp_peifang_list.size() == 0) {
						return;
					}
					m_current_map_key = getPeiFangKey(m_dongfu_jbp_peifang_list);
					m_dongfu_name_jbp = getPeiFangName(m_dongfu_jbp_peifang_list);
					GameManager.getInstance().m_game_message
							.sendDongFuStartProduction(DONGFU_LABEL_JBP,
									m_current_map_key, 1);
					break;
				case DONGFU_LABEL_BGL:
					if (m_dongfu_bgl_peifang_list == null
							|| m_dongfu_bgl_peifang_list.size() == 0) {
						return;
					}
					m_current_map_key = getPeiFangKey(m_dongfu_bgl_peifang_list);
					GameManager.getInstance().m_game_message
							.sendDongFuGetPropMsg(m_current_map_key);
					break;
				case DONGFU_LABEL_TGF:
					if (m_dongfu_tgf_peifang_list == null
							|| m_dongfu_tgf_peifang_list.size() == 0) {
						return;
					}
					m_current_map_key = getPeiFangKey(m_dongfu_tgf_peifang_list);
					GameManager.getInstance().m_game_message
							.sendDongFuGetPropMsg(m_current_map_key);
					break;
			}
		}
		else if (AbstractGameScreen
				.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
			DONGFU_UI_CURRENT = DONGFU_UIMAIN; // 返回主界面
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_UP)) {
			ArrayList list = null;
			byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
			switch (itemNum) {
				case DONGFU_LABEL_YQS:
//					list = m_dongfu_yqs_peifang_list;
					break;
				case DONGFU_LABEL_JBP:
					list = m_dongfu_jbp_peifang_list;
					break;
				case DONGFU_LABEL_BGL:
					list = m_dongfu_bgl_peifang_list;
					break;
				case DONGFU_LABEL_TGF:
					list = m_dongfu_tgf_peifang_list;
					break;
			}
			if (list == null || list.size() == 0) {
				return;
			}
			if (m_dongfu_peifang_currentindex > m_dongfu_paifang_currentPage * m_dongfu_paifang_onePage_howLine) {
				m_dongfu_peifang_currentindex--;
			}
			else if (m_dongfu_paifang_currentPage != 0) {
				m_dongfu_paifang_currentPage--;
				m_dongfu_peifang_currentindex--;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_DOWN)) {
			ArrayList list = null;
			byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
			switch (itemNum) {
				case DONGFU_LABEL_YQS:
//					list = m_dongfu_yqs_peifang_list;
					break;
				case DONGFU_LABEL_JBP:
					list = m_dongfu_jbp_peifang_list;
					break;
				case DONGFU_LABEL_BGL:
					list = m_dongfu_bgl_peifang_list;
					break;
				case DONGFU_LABEL_TGF:
					list = m_dongfu_tgf_peifang_list;
					break;
			}
			if (list == null || list.size() == 0) {
				return;
			}
			if (m_dongfu_peifang_currentindex < ((m_dongfu_paifang_currentPage != (m_dongfu_paifang_sumPage - 1)) ?
					((m_dongfu_paifang_currentPage + 1) * m_dongfu_paifang_onePage_howLine - 1) : (list.size() - 1))) {
				m_dongfu_peifang_currentindex++;
			}
			else if (m_dongfu_paifang_currentPage != (m_dongfu_paifang_sumPage - 1)) {
				m_dongfu_peifang_currentindex++;
				m_dongfu_paifang_currentPage++;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT)) {
			if (m_dongfu_paifang_currentPage > 0) {
				m_dongfu_paifang_currentPage--;
				m_dongfu_peifang_currentindex = m_dongfu_paifang_currentPage * m_dongfu_paifang_onePage_howLine;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT)) {
			if (m_dongfu_paifang_currentPage < m_dongfu_paifang_sumPage - 1) {
				m_dongfu_paifang_currentPage++;
				m_dongfu_peifang_currentindex = m_dongfu_paifang_currentPage * m_dongfu_paifang_onePage_howLine;
			}
		}
	}

	private void gettStuffList()
	{
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int size = m_dongfu_need_Prop.size();
		m_bag_prop_nums = new int[size];
		for (int i = 0; i < size; i++) {
			ActorItem item1 = (ActorItem) m_dongfu_need_Prop.elementAt(i);
			for (int j = 0; j < actorItem.length; j++) {
				if (actorItem[j] == null) {
					continue;
				}
				ActorItem item2 = actorItem[j];
				if (item1.m_key.equals(item2.m_key)) {
					m_bag_prop_nums[i] += item2.m_num;
				}
			}
		}

	}

	private int[] m_bag_prop_nums;

	/**
	 * 主界面按键监听
	 */
	private void logicMain()
	{
		if (!m_dongfu_is_self) {

			if (AbstractGameScreen
					.haveKeyPressed(AbstractGameScreen.GK_KEY1)) {
				if (m_dongfu_yqs_status == 1) {
					GameManager.getInstance().m_game_message.sendwatering((byte) 1, m_currentDongFuID);
					m_dongfu_is_jiaoguang = 0;
				}
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
//				GameManager.getInstance().m_game_message.sendDongFuOut();
				close();
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
					|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			}
		}
		else {
			if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_D)) {
				if (m_dongfu_label_currentindex > 0) {
					m_dongfu_label_currentindex--;
				}
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
//				GameManager.getInstance().m_game_message.sendDongFuOut();
				close();
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
					|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
			}
			else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_B)) {
				if (m_dongfu_label_currentindex < (m_openDongFuLableNUm - 1)) {
					m_dongfu_label_currentindex++;
				}
			}
			else {
				if (m_openDongFuLable != null && m_openDongFuLable.size() != 0) {

					byte itemNum = ((Byte) m_openDongFuLable.elementAt(m_dongfu_label_currentindex)).byteValue();
					switch (itemNum) {
						case DONGFU_LABEL_YQS:
							logicyqs();
							break;
						case DONGFU_LABEL_JBP:
							logicjbp();
							break;
						case DONGFU_LABEL_BGL:
							logicbgl();
							break;
						case DONGFU_LABEL_TGF:
							logictgf();
							break;
					}
				}
			}
		}
	}

	/**
	 * 摇钱树按键监听
	 */
	private void logicyqs()
	{

		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY2)) {
			switch (m_dongfu_yqs_status) {
				case 1: // 生产中
					if (m_dongfu_is_jiaoguang == 1) {
						GameManager.getInstance().m_game_message.sendwatering((byte) 1, m_currentDongFuID);
						m_dongfu_is_jiaoguang = 0;
					}
					break;
				case 2: // 收获
					GameManager.getInstance().m_game_message.sendDongFuReap(
							DONGFU_LABEL_YQS, "", m_dongfu_number_yqs);
					break;
				case 3: // 今天已收获
					break;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY1)) {
			GameManager.getInstance().m_game_message.sendDongFuWateringPlayerMsg(m_currentDongFuID);
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY3)) {
			UISocialWindow.openFriendWindow();
		}

	}

	/**
	 * 聚宝盆按键监听
	 */
	private void logicjbp()
	{

		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY2)) {
			switch (m_dongfu_jbp_status) {
				case 0: // 开始生产
					getPeiFangListjbp();
					DONGFU_UI_CURRENT = DONGFU_UIPEIFANG;
					break;
				case 1: // 加速
//					getADDSpeedPropJBP();
//					DONGFU_UI_CURRENT = DONGFU_UIADDSPEED;
					GameManager.getInstance().m_game_message.sendDongFuSpeed(DONGFU_LABEL_JBP);
					break;
				case 2: // 收获
					GameManager.getInstance().m_game_message.sendDongFuReap(
							DONGFU_LABEL_JBP, m_dongfu_key_jbp, m_dongfu_jbp_current_multiple);
					break;
			}
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY1)) {
			GameManager.getInstance().m_game_message.sendDongFuGongFAMSG(m_currentDongFuID);
		}
		else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY3)) {
			UISocialWindow.openGongFaWindow();
		}

	}

	/**
	 * 获得加速道具列表
	 */
	private void getADDSpeedPropJBP()
	{
		m_dongfu_add_speedList.removeAllElements();
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int itemSize = actorItem.length;
		for (int i = 0; i < itemSize; i++) {
			if (actorItem[i] == null) {
				continue;
			}
			ActorItem item = actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_CONSUME_ADD_SPEED_JBP) {
				int size = m_dongfu_add_speedList.size();
				boolean isHave = true;
				for (int j = 0; j < size; j++) {
					ActorItem item2 = (ActorItem) m_dongfu_add_speedList
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break;
					}
				}
				if (isHave) {
					m_dongfu_add_speedList.addElement(actorItem[i]);

				}
			}
		}
		m_dongfu_peifang_array = null;
		m_dongfu_peifang_array = new int[m_dongfu_add_speedList.size()];
		Hashtable itemNum = GameManager.getInstance().m_role.m_items;
		int bgllistsize = m_dongfu_add_speedList.size();
		for (int i = 0; i < bgllistsize; i++) {
			ActorItem item3 = (ActorItem) m_dongfu_add_speedList.elementAt(i);
			GameItem gameItem = (GameItem) itemNum.get(item3.m_key);
			m_dongfu_peifang_array[i] = gameItem.m_num;
		}
		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_add_speedList.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_add_speedList != null && m_dongfu_add_speedList.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

	private void getPeiFangListjbp()
	{
		m_dongfu_jbp_peifang_list.removeAllElements();
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		i: for (int i = 0; i < actorItem.length; i++) {
			if (actorItem[i] == null) {
				continue;
			}

			ActorItem item = actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_MATERIAL_NORMAL) {
				int size = m_dongfu_jbp_peifang_list.size();
				boolean isHave = true;
				ii: for (int j = 0; j < size; j++) {
					ActorItem item2 = (ActorItem) m_dongfu_jbp_peifang_list
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break ii;
					}
				}
				if (isHave) {
					m_dongfu_jbp_peifang_list.addElement(actorItem[i]);
				}
			}
		}
		m_dongfu_peifang_array = null;
		m_dongfu_peifang_array = new int[m_dongfu_jbp_peifang_list.size()];
//		Hashtable itemNum = GameManager.getInstance().m_role.m_items;
		int bgllistsize = m_dongfu_jbp_peifang_list.size();
		for (int i = 0; i < bgllistsize; i++) {
			ActorItem item3 = (ActorItem) m_dongfu_jbp_peifang_list.elementAt(i);
			int num = 0;
			for (int j = 0; j < actorItem.length; j++) {
				ActorItem itemnum = actorItem[j];
				if (itemnum == null) {
					continue;
				}
				if (item3.m_key.equals(itemnum.m_key)) {
					num = num + itemnum.m_num;
				}
			}
			m_dongfu_peifang_array[i] = num;
		}
		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_jbp_peifang_list.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_jbp_peifang_list != null
				&& m_dongfu_jbp_peifang_list.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

	/**
	 * 八卦炉按键监听
	 */
	private void logicbgl()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY2)) {
			switch (m_dongfu_bgl_status) {
				case 0: // 开始生产按钮
					// 获得配方列表
					getPeiFangListbgl();
					DONGFU_UI_CURRENT = DONGFU_UIPEIFANG;
					break;
				case 1: // 加速
//					getADDSpeedPropBGL();
//					DONGFU_UI_CURRENT = DONGFU_UIADDSPEED;
					GameManager.getInstance().m_game_message.sendDongFuSpeed(DONGFU_LABEL_BGL);
					break;
				case 2: // 收获
					GameManager.getInstance().m_game_message.sendDongFuReap(
							DONGFU_LABEL_BGL, m_dongfu_key_bgl, m_dongfu_number_bgl);
					break;
			}
		}
	}

	/**
	 * 获得加速道具列表
	 */
	private void getADDSpeedPropBGL()
	{
		m_dongfu_add_speedList.removeAllElements();
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int itemSize = actorItem.length;
		for (int i = 0; i < itemSize; i++) {
			if (actorItem[i] == null) {
				continue;
			}

			ActorItem item = actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_CONSUME_ADD_SPEED_JBP) {
				int size = m_dongfu_add_speedList.size();
				boolean isHave = true;
				for (int j = 0; j < size; j++) {
					ActorItem item2 = (ActorItem) m_dongfu_add_speedList
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break;
					}
				}
				if (isHave) {
					m_dongfu_add_speedList.addElement(actorItem[i]);

				}
			}
		}
		m_dongfu_peifang_array = null;
		m_dongfu_peifang_array = new int[m_dongfu_add_speedList.size()];
		Hashtable itemNum = GameManager.getInstance().m_role.m_items;
		int bgllistsize = m_dongfu_add_speedList.size();
		for (int i = 0; i < bgllistsize; i++) {
			ActorItem item3 = (ActorItem) m_dongfu_add_speedList.elementAt(i);
			GameItem gameItem = (GameItem) itemNum.get(item3.m_key);
			m_dongfu_peifang_array[i] = gameItem.m_num;
		}

		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_add_speedList.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_add_speedList != null && m_dongfu_add_speedList.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

	private int[] m_dongfu_peifang_array;

	private void getPeiFangListbgl()
	{
		m_dongfu_bgl_peifang_list.removeAllElements();
		m_dongfu_peifang_array = null;
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int aiLength = actorItem.length;
		for (int i = 0; i < aiLength; i++) {
			if (actorItem[i] == null) {
				continue;
			}
			ActorItem item = actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_MATERIAL_PAPER_BAGUALU) {
				int size = m_dongfu_bgl_peifang_list.size();
				boolean isHave = true;
				for (int j = 0; j < size; j++) {
//					ActorItem item2 = (ActorItem) m_dongfu_bgl_peifang_list
//							.elementAt(j);
					ActorItemFomula item2 = (ActorItemFomula) m_dongfu_bgl_peifang_list
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break;
					}
				}
				if (isHave) {
//					m_dongfu_bgl_peifang_list.addElement(item);
					ActorItemFomula itemF = (ActorItemFomula) item;
					if (itemF.m_grade <= m_dongfu_bgl_grade) {
						m_dongfu_bgl_peifang_list.addElement(item);
					}
				}
			}
		}
		m_dongfu_peifang_array = new int[m_dongfu_bgl_peifang_list.size()];
		int bgllistsize = m_dongfu_bgl_peifang_list.size();
		for (int i = 0; i < bgllistsize; i++) {
			ActorItemFomula item3 = (ActorItemFomula) m_dongfu_bgl_peifang_list.elementAt(i);
			int num = 0;
			for (int j = 0; j < actorItem.length; j++) {
				ActorItem itemnum = actorItem[j];
				if (itemnum == null) {
					continue;
				}
				if (item3.m_key.equals(itemnum.m_key)) {
					num = num + itemnum.m_num;
				}
			}
			m_dongfu_peifang_array[i] = num;
		}
		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_bgl_peifang_list.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_bgl_peifang_list != null
				&& m_dongfu_bgl_peifang_list.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

	/**
	 * 天工坊按键监听
	 */
	private void logictgf()
	{
		if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_KEY2)) {
			switch (m_dongfu_tgf_status) {
				case 0: // 开始生产
					getPeiFangListtgf();
					DONGFU_UI_CURRENT = DONGFU_UIPEIFANG;
					break;
				case 1: // 加速
//					getADDSpeedPropTGF();
//					DONGFU_UI_CURRENT = DONGFU_UIADDSPEED;
					GameManager.getInstance().m_game_message.sendDongFuSpeed(DONGFU_LABEL_TGF);
					break;
				case 2: // 收获
					GameManager.getInstance().m_game_message.sendDongFuReap(
							DONGFU_LABEL_TGF, m_dongfu_key_tgf, m_dongfu_number_tgf);
					break;
			}
		}
	}

	/**
	 * 获得加速道具列表
	 */
	private void getADDSpeedPropTGF()
	{
		m_dongfu_add_speedList.removeAllElements();
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int itemSize = actorItem.length;
		for (int i = 0; i < itemSize; i++) {
			if (actorItem[i] == null) {
				continue;
			}

			ActorItem item = actorItem[i];
//			ActorItemFomula item=(ActorItemFomula) actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_CONSUME_ADD_SPEED_JBP) {
				int size = m_dongfu_add_speedList.size();
				boolean isHave = true;
				for (int j = 0; j < size; j++) {
					ActorItem item2 = (ActorItem) m_dongfu_add_speedList
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break;
					}
				}
				if (isHave) {
					m_dongfu_add_speedList.addElement(actorItem[i]);
//					if (item.m_grade<=m_dongfu_tgf_grade) {
//						m_dongfu_add_speedList.addElement(actorItem[i]);
//					}
				}
			}
		}
		m_dongfu_peifang_array = null;
		int bgllistsize = m_dongfu_add_speedList.size();
		m_dongfu_peifang_array = new int[bgllistsize];
		Hashtable itemNum = GameManager.getInstance().m_role.m_items;
		for (int i = 0; i < bgllistsize; i++) {
			ActorItem item3 = (ActorItem) m_dongfu_add_speedList.elementAt(i);
			GameItem gameItem = (GameItem) itemNum.get(item3.m_key);
			m_dongfu_peifang_array[i] = gameItem.m_num;
		}
		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_add_speedList.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_add_speedList != null && m_dongfu_add_speedList.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

//	private int m_dongfu_peifang_tgfNum[]; ///天工坊 每种配方的数量

	private void getPeiFangListtgf()
	{
		m_dongfu_tgf_peifang_list.removeAllElements();
		m_dongfu_peifang_array = null;
		ActorItem[] actorItem = GameManager.getInstance().m_role.m_bag_goods;
		int aiLength = actorItem.length;
		for (int i = 0; i < aiLength; i++) {
			if (actorItem[i] == null) {
				continue;
			}
			ActorItem item = actorItem[i];
//			ActorItem item = actorItem[i];
			if (item.m_type == ActorItem.TYPE_GOODS_MATERIAL
					&& item.m_type_detail == ActorItem.TYPE_MATERIAL_PAPER_TIANGONGFANG) {
				int size = m_dongfu_tgf_peifang_list.size();
				boolean isHave = true;
				for (int j = 0; j < size; j++) {
//					ActorItem item2 = (ActorItem) m_dongfu_tgf_peifang_list
//							.elementAt(j);
					ActorItemFomula item2 = (ActorItemFomula) m_dongfu_tgf_peifang_list
							.elementAt(j);
					if (item.m_key.equals(item2.m_key)) {
						isHave = false;
						break;
					}
				}
				if (isHave) {
//					m_dongfu_bgl_peifang_list.addElement(item);
					ActorItemFomula itemF = (ActorItemFomula) item;
					if (itemF.m_grade <= m_dongfu_tgf_grade) {
						m_dongfu_tgf_peifang_list.addElement(item);
					}
				}
			}
		}
		m_dongfu_peifang_array = new int[m_dongfu_tgf_peifang_list.size()];
//		Hashtable itemNum = GameManager.getInstance().m_role.m_items;
		int bgllistsize = m_dongfu_tgf_peifang_list.size();
		for (int i = 0; i < bgllistsize; i++) {
//			ActorItem item3 = (ActorItem) m_dongfu_tgf_peifang_list.elementAt(i);
			ActorItemFomula item3 = (ActorItemFomula) m_dongfu_tgf_peifang_list.elementAt(i);
			int num = 0;
			for (int j = 0; j < actorItem.length; j++) {
				ActorItem itemnum = actorItem[j];
				if (itemnum == null) {
					continue;
				}
				if (item3.m_key.equals(itemnum.m_key)) {
					num = num + itemnum.m_num;
				}
			}
			m_dongfu_peifang_array[i] = num;
		}
		m_dongfu_paifang_currentPage = 0;
		m_dongfu_paifang_sumPage = (m_dongfu_tgf_peifang_list.size() / m_dongfu_paifang_onePage_howLine) + 1;
		if (m_dongfu_tgf_peifang_list != null
				&& m_dongfu_tgf_peifang_list.size() != 0) {
			m_dongfu_peifang_currentindex = 0;
		}
		else {
			m_dongfu_peifang_currentindex = -1;
		}
	}

	private String M_GongFaMSG_LABLE = "查看被攻伐情况";

	/**
	 * 绘制查看被攻伐记录
	 */
	private void drawDongFuGongFaMSG(Graphics g)
	{
		drawDongFuSubclassUILable(g, M_GongFaMSG_LABLE); // 标头
		int size = m_GongFaMsgStringList.length;
		if (size > 0) {
			UITools.paintScrollBar(g, m_x + UITools.X_DRAG, DONGFU_UIPEIFANG_FREAM_Y + 4,
					DONGFU_UIPEIFANG_FREAM_H, m_index_DongFuGongfaList * 100 / size);
		}
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		g.setColor(Tools.YELLOW);
		for (int i = 0; i < m_gongfaMsg_num; i++) {
			if (i + m_index_DongFuGongfaList >= size) {
				continue;
			}
			String item = m_GongFaMsgStringList[i];
			g.drawString(item, DONGFU_UIPEIFANG_FREAM_X + 4,
					DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i) + 3,
					Graphics.LEFT | Graphics.TOP);
		}
	}

	/**
	 * 绘制配方界面
	 * isXnum 是否显示个数
	 * @param g
	 */
	private void drawDongFuPeiFang(Graphics g, ArrayList list, String lableName, boolean isXnum)
	{
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		for (int i = m_dongfu_paifang_currentPage * m_dongfu_paifang_onePage_howLine; i < ((m_dongfu_paifang_currentPage == (m_dongfu_paifang_sumPage - 1) ? list
				.size()
				: (m_dongfu_paifang_currentPage + 1) * m_dongfu_paifang_onePage_howLine)); i++) {
			ActorItem item = (ActorItem) list.elementAt(i);
			g.setColor(Tools.YELLOW);
			if (isXnum) {
				g.drawString(item.m_name + " X" + m_dongfu_peifang_array[i], AbstractGameScreen.SCREEN_WIDTH >> 1,
						DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i % m_dongfu_paifang_onePage_howLine) + 3,
						Graphics.HCENTER | Graphics.TOP);
			}
			else {
				g.drawString(item.m_name, AbstractGameScreen.SCREEN_WIDTH >> 1,
						DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i % m_dongfu_paifang_onePage_howLine) + 3,
						Graphics.HCENTER | Graphics.TOP);
			}
			if (i == m_dongfu_peifang_currentindex) {
				g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
				UITools.drawSelectBox(g, DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y + LIST_RECT_H
						* (i % m_dongfu_paifang_onePage_howLine),
						DONGFU_UIPEIFANG_FREAM_W, LIST_RECT_H);
			}
		}
		drawDongFuSubclassUILable(g, lableName);
		// 绘制翻页
		g.setClip(AbstractGameScreen.SCREEN_WIDTH / 2 - 10, DONGFU_UIPEIFANG_FREAM_Y
				+ LIST_RECT_H, 20, 20);
		UITools.paintPage(g, m_x + (m_w >> 1), m_y + m_h - UITools.IW_WIN,
				m_dongfu_paifang_currentPage, m_dongfu_paifang_sumPage);
	}

	private void drawDongFuSubclassUILable(Graphics g, String name)
	{
		UITools.drawListTitleItem(g, DONGFU_UIPEIFANG_X, DONGFU_UIPEIFANG_Y,
				DONGFU_UIPEIFANG_W, DONGFU_UIPEIFANG_H, name);
		UITools.drawListFrame(g, DONGFU_UIPEIFANG_FREAM_X,
				DONGFU_UIPEIFANG_FREAM_Y, DONGFU_UIPEIFANG_FREAM_W,
				DONGFU_UIPEIFANG_FREAM_H);
	}

	private int m_index_dongfu_peifang = 0;

	/***
	 * 绘制材料显示界面
	 * 
	 * @param g
	 * @param list
	 * @param lableName
	 */
	private void drawDongFuStuff(Graphics g, ArrayList list, String lableName,
			String oneLineUnit)
	{
		String lableString = "";
		for (int i = 0; i < m_dongfu_get_Prop.size(); i++) {
			lableString = lableString
					+ ((ActorItem) m_dongfu_get_Prop.elementAt(i)).m_name;
		}
		drawDongFuSubclassUILable(g, lableName + lableString);
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		g.setColor(Tools.YELLOW);
		g.drawString("消耗：", m_x + (m_w >> 1),
				DONGFU_UIPEIFANG_FREAM_Y + 2 + 3, Graphics.HCENTER
						| Graphics.TOP); // 画第一行文字
		if (m_need_vim <= GameManager.getInstance().m_role.m_jinglizhi_shengyu) {
			g.drawString("精力值" + m_need_vim + "/" + m_need_vim,
					m_x + (m_w >> 1), DONGFU_UIPEIFANG_FREAM_Y
							+ 2 + LIST_RECT_H + 3, Graphics.HCENTER | Graphics.TOP); // 画精力
		}
		else {
			g.setColor(Tools.RED);
			g.drawString("精力值" + m_need_vim + "/" + GameManager.getInstance().m_role.m_jinglizhi_shengyu,
					m_x + (m_w >> 1), DONGFU_UIPEIFANG_FREAM_Y
							+ 2 + LIST_RECT_H + 3, Graphics.HCENTER | Graphics.TOP); // 画精力
		}

		int size = list.size();
		if (size > 0) {

			UITools.paintScrollBar(g, m_x + UITools.X_DRAG, DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * 2 + 3,
					m_peifang_num * LIST_RECT_H, m_index_dongfu_peifang * 100 / size);
		}
		// 材料界面
		g.setClip(m_x, DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * 2 + 3, m_w, m_peifang_num * LIST_RECT_H);
		g.setColor(Tools.YELLOW);
		for (int i = 0; i < m_peifang_num; i++) {
			if (i + m_index_dongfu_peifang >= size) {
				continue;
			}
			ActorItem item1 = (ActorItem) list.elementAt(i + m_index_dongfu_peifang);
			// ActorItem item2 = (ActorItem) bagneedList.elementAt(i);
			if (item1.m_num <= m_bag_prop_nums[i + m_index_dongfu_peifang]) {
				g.setColor(Tools.YELLOW);
				g.drawString(item1.m_name + item1.m_num + "/" + item1.m_num,
						m_x + (m_w >> 1), DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i + 2) + 3,
						Graphics.HCENTER | Graphics.TOP);
			}
			else {
				g.setColor(Tools.RED);
				g.drawString(item1.m_name + item1.m_num + "/" + m_bag_prop_nums[i + m_index_dongfu_peifang],
						m_x + (m_w >> 1), DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i + 2) + 3,
						Graphics.HCENTER | Graphics.TOP);
			}
		}
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		g.setColor(Tools.YELLOW);
		if (m_StuffIsEnough) {
			ActorItem item = (ActorItem) m_dongfu_get_Prop.elementAt(0);
			g.drawString("获得:" + item.m_name + "   x" + item.m_num, DONGFUSTUFF_MAXNUM_X, DONGFUSTUFF_MAXNUM_Y,
					Graphics.TOP | Graphics.HCENTER);
		}
		else {
			UITools.drawColorString(g, "材料不足", DONGFUSTUFF_MAXNUM_X, DONGFUSTUFF_MAXNUM_Y, Tools.RED, Graphics.TOP
					| Graphics.HCENTER);
		}

//		g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_CBD_SELECT));
//		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
//				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
//		g.drawRect(DONGFUSTUFF_MAXNUM_X - (DONGFUSTUFF_MAXNUM_W >> 1),
//				DONGFUSTUFF_MAXNUM_Y, DONGFUSTUFF_MAXNUM_W,
//				DONGFUSTUFF_MAXNUM_H);
//		UITools.drawColorString(g, m_need_prodction + "", DONGFUSTUFF_MAXNUM_X,
//				DONGFUSTUFF_MAXNUM_Y, Tools.YELLOW, Graphics.HCENTER
//				| Graphics.TOP);
//		UITools.drawColorString(g, " +  /" + m_max_prodctionNum + " 份",
//				DONGFUSTUFF_MAXNUM_X + (DONGFUSTUFF_MAXNUM_W >> 1),
//				DONGFUSTUFF_MAXNUM_Y, Tools.YELLOW, Graphics.LEFT
//				| Graphics.TOP);
//		UITools.drawColorString(g, "可" + lableName + " - ",
//				DONGFUSTUFF_MAXNUM_X - (DONGFUSTUFF_MAXNUM_W >> 1),
//				DONGFUSTUFF_MAXNUM_Y, Tools.YELLOW, Graphics.TOP
//				| Graphics.RIGHT);
	}

	private int getmaxProductionNum(ArrayList list)
	{
		int minNum = 0;
		if (list != null && list.size() != 0) {
			int[] otherNum = new int[list.size()];
			for (int i = 0; i < list.size(); i++) {
				ActorItem item1 = (ActorItem) list.elementAt(i);
				otherNum[i] = m_bag_prop_nums[i] / item1.m_num;
			}
			minNum = otherNum[0];
			for (int i = 1; i < otherNum.length; i++) {
//				minNum = otherNum[i];
				if (otherNum[i] < minNum) {
					minNum = otherNum[i];
				}
			}
		}
		return minNum;
	}

	/**
	 * 绘制确认界面
	 * 
	 * @param g
	 * @param lableName
	 * @param oneLineUnit
	 */
	private void drawDongFuStartMake(Graphics g, String lableName,
			String oneLineUnit)
	{
		String lableString = "";
		for (int i = 0; i < m_dongfu_get_Prop.size(); i++) {
			lableString = lableString
					+ ((ActorItem) m_dongfu_get_Prop.elementAt(i)).m_name;
		}
		drawDongFuSubclassUILable(g, "开始" + lableName); // 标头
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_CBD_DEEP));
//		g.fillRect(DONGFU_UIPEIFANG_FREAM_X + 2, DONGFU_UIPEIFANG_FREAM_Y + 2,
//				DONGFU_UIPEIFANG_FREAM_W - 3, DONGFU_UIPEIFANG_FREAM_H - 3);
		g.setColor(Tools.YELLOW);
		g.drawString(lableName + m_need_prodction + oneLineUnit + lableString,
				AbstractGameScreen.SCREEN_WIDTH >> 1,
				DONGFU_UIPEIFANG_FREAM_Y + 2 + 3, Graphics.HCENTER
						| Graphics.TOP); // 画第一行文字
		g.drawString("共消耗：", AbstractGameScreen.SCREEN_WIDTH >> 1,
				DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H + 3,
				Graphics.HCENTER | Graphics.TOP);
		g.drawString("精力值" + m_need_vim, AbstractGameScreen.SCREEN_WIDTH >> 1,
				DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * 2 + 3,
				Graphics.HCENTER | Graphics.TOP);
		int size = m_dongfu_need_Prop.size();
		if (size > 0) {

			UITools.paintScrollBar(g, m_x + UITools.X_DRAG, DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * 3 + 3,
					m_peifangstart_num * LIST_RECT_H, m_index_dongfu_start * 100 / size);
		}
		g.setColor(Tools.YELLOW);
		for (int i = 0; i < m_peifangstart_num; i++) {
			if (i + m_index_dongfu_start >= size) {
				continue;
			}
			ActorItem item = (ActorItem) m_dongfu_need_Prop.elementAt(i + m_index_dongfu_start);
			g.drawString(item.m_name + item.m_num * m_need_prodction,
					AbstractGameScreen.SCREEN_WIDTH >> 1,
					DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i + 3) + 3,
					Graphics.HCENTER | Graphics.TOP);
		}
	}

	int m_index_dongfu_start = 0;

	/**
	 * 绘制摇钱树相关
	 * 
	 * @param g
	 */
	private void drawDongFuYQS(Graphics g)
	{
		g.setClip(m_x, Y_MIDDLE_LABEL, m_w, UITools.H_BUTTON);
		if (m_dongfu_is_self) {
			drawLabel(g, MIDDLE_LABEL1_X, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][5], true);
			drawLabel(g, MIDDLE_LABEL3_X, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][6], true);
		}
		switch (m_dongfu_yqs_status) {
			case 1: // 摇钱树，浇灌
				if (m_dongfu_is_self) {
					if (m_dongfu_is_jiaoguang == 0) {
						drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][4], false);
					}
					else {
						drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
								DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
								true);
					}
				}
				else {
					if (m_dongfu_is_jiaoguang_other == 1) {
						drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][4], false);
					}
					else {
						drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
								DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status], true);
					}
				}
				g.setClip((AbstractGameScreen.SCREEN_WIDTH >> 1)
						- ((img_status_yes.getWidth() * m_dongfu_jiaoguang_sum) >> 1),
						YQS_JIAOGUANG_LABEL_Y, img_status_yes.getWidth()
								* m_dongfu_jiaoguang_sum, img_status_yes
								.getHeight());
				for (int i = 0; i < m_dongfu_jiaoguang_number; i++) {
					g.drawImage(img_status_yes,
							((AbstractGameScreen.SCREEN_WIDTH - img_status_yes
									.getWidth()
									* m_dongfu_jiaoguang_sum) >> 1)
									+ img_status_yes.getWidth() * i,
							YQS_JIAOGUANG_LABEL_Y, Tools.LEFT_TOP);
				}
				for (int i = m_dongfu_jiaoguang_number; i < m_dongfu_jiaoguang_sum; i++) {
					g.drawImage(img_status_no,
							((AbstractGameScreen.SCREEN_WIDTH - img_status_yes
									.getWidth()
									* m_dongfu_jiaoguang_sum) >> 1)
									+ img_status_yes.getWidth() * i,
							YQS_JIAOGUANG_LABEL_Y, Tools.LEFT_TOP);
				}
//				anim_yqs.draw(g, (AbstractGameScreen.SCREEN_WIDTH >> 1), anim_y,
//						false, false, 1);
				actor_yqs.draw(g, 0, 0);
				actor_yqs.nextFrame();
				break;
			case 2:// 2收获
				if (m_dongfu_is_self) {
					drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
							DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
							true);
				}
				else {
					drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
							DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
							true);
				}

//				anim_yqs.draw(g, (AbstractGameScreen.SCREEN_WIDTH >> 1), anim_y,
//						false, false, 2);
				actor_yqs.draw(g, 0, 0);
				actor_yqs.nextFrame();
				break;
			case 3:// 今日 已经收获，
				if (m_dongfu_is_self) {
					drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
							DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
							true);
				}
				else {
					drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
							DONGFU_LABEL_STRING[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
							true);
				}

//				anim_yqs.draw(g, (AbstractGameScreen.SCREEN_WIDTH >> 1), anim_y,
//						false, false, 0);
				actor_yqs.draw(g, 0, 0);
				actor_yqs.nextFrame();
				break;
		}
		g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
		g.drawString(m_dongfu_yqs_grade + DONGFU_UP_MSG[DONGFU_LABEL_YQS][0]
				+ m_dongfu_number_yqs + DONGFU_UP_MSG[DONGFU_LABEL_YQS][1],
				AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
				Tools.HCENTER_TOP);
//		g.drawString(DONGFU_MIDDLE_MSG[0]
//				+ (m_dongfu_yqs_needOver_num - m_dongfu_yqs_over_num)
//				+ DONGFU_MIDDLE_MSG[1] + (m_dongfu_yqs_grade + 1)
//				+ DONGFU_MIDDLE_MSG[2], AbstractGameScreen.SCREEN_WIDTH >> 1,
//				MIDDLE_ONELINE_STRING_Y, Tools.HCENTER_TOP);
		if (m_dongfu_is_jiaoguang == 0 && m_dongfu_yqs_status == 1) {
			g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_YQS][4],
					AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
					Tools.HCENTER_TOP);
		}
		else {
			g.drawString(
					DONGFU_DOWN_MSG[DONGFU_LABEL_YQS][m_dongfu_yqs_status],
					AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
					Tools.HCENTER_TOP);
		}
	}

	/**
	 * 绘制标签
	 * 
	 * @param g
	 * @param x
	 * @param y
	 * @param color
	 * @param str
	 * @param isSel
	 */
	private void drawLabel(Graphics g, int x, int y, String str, boolean isSel)
	{
		// int color = isSel ?
		// UIManager.getPaletteColor(UIPalette.COLOR_WORD_YESS) :
		// UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS) ;
		UITools.paintLabelStr(g, x, y, UITools.W_LABEL_BIG, UITools.H_LABEL,
				str, isSel);
	}

	/**
	 * 绘制标签
	 * 
	 * @param g
	 * @param x
	 * @param y
	 * @param color
	 * @param str
	 * @param isSel
	 */
	private void drawLabel(Graphics g, int x, int y, String str, boolean isLight, boolean isSel)
	{
		// int color = isSel ?
		// UIManager.getPaletteColor(UIPalette.COLOR_WORD_YESS) :
		// UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS) ;
		UITools.paintLabelStr(g, x, y, UITools.W_LABEL_BIG, UITools.H_LABEL, str, isLight, isSel);
	}

	/**
	 * 绘制聚宝盆相关
	 * 
	 * @param g
	 */
	private void drawDongFuJBP(Graphics g)
	{
		g.setClip(m_x, Y_MIDDLE_LABEL, m_w, UITools.H_BUTTON);
		drawLabel(g, MIDDLE_LABEL1_X, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_JBP][3], true);
		drawLabel(g, MIDDLE_LABEL3_X, Y_MIDDLE_LABEL, DONGFU_LABEL_STRING[DONGFU_LABEL_JBP][4], true);
		switch (m_dongfu_jbp_status) {
			case 0: // 投入
				drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_JBP][m_dongfu_jbp_status],
						true);
				actor_jbp.draw(g, 0, 0);
				actor_jbp.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_jbp_grade + DONGFU_UP_MSG[DONGFU_LABEL_JBP][0] + m_dongfu_jbp_multiple
						+ DONGFU_UP_MSG[DONGFU_LABEL_JBP][1], m_x + (m_w >> 1), UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_JBP][0],
						m_x + (m_w >> 1), DOWN_STRING_Y, Tools.HCENTER_TOP);
				break;
			case 1: // 生产中

				drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_JBP][m_dongfu_jbp_status],
						true);

				g.setClip(img_progressBar_x, img_progressBar_y, img_progressBar_w,
						img_progressBar_h);
				g.drawImage(img_progressBar, img_progressBar_x, img_progressBar_y,
						Tools.LEFT_TOP);
				if (m_dongfu_time_jbp_sum != 0) {
					g.setColor(Tools.RED);
					g.fillRect(
							img_progressBar_x + 7,
							img_progressBar_y + 3,
							((m_dongfu_time_jbp_sum - m_dongfu_jbp_time) * (img_progressBar_w - 14))
									/ m_dongfu_time_jbp_sum, 3);
				}
				actor_jbp.draw(g, 0, 0);
				actor_jbp.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(
						DONGFU_UP_MSG[DONGFU_LABEL_JBP][2] + m_dongfu_name_jbp+m_dongfu_jbp_current_multiple+"份",
						m_x + (m_w >> 1), UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				int h = m_dongfu_jbp_time / GameManager.FRAME_PER_SECOND / 3600;
				int m = m_dongfu_jbp_time / GameManager.FRAME_PER_SECOND / 60 % 60;
				int s = m_dongfu_jbp_time / GameManager.FRAME_PER_SECOND % 60 % 60;
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_JBP][1]
						+ (h > 9 ? "" : "0") + h + ":" + (m > 9 ? "" : "0") + m
						+ ":" + (s > 9 ? "" : "0") + s,
						m_x + (m_w >> 1), DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
			case 2:// 收取
				drawLabel(g, MIDDLE_LABEL2_X, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_JBP][m_dongfu_jbp_status],
						true);

//				anim_jbp.draw(g, AbstractGameScreen.SCREEN_WIDTH >> 1, anim_y,
//						false, false, 2);
				actor_jbp.draw(g, 0, 0);
				actor_jbp.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_jbp_grade + DONGFU_UP_MSG[DONGFU_LABEL_JBP][0] + m_dongfu_jbp_multiple
						+ DONGFU_UP_MSG[DONGFU_LABEL_JBP][1], m_x + (m_w >> 1), UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_JBP][2],
						m_x + (m_w >> 1), DOWN_STRING_Y, Tools.HCENTER_TOP);
				break;
		}
		if (m_jbp_baohushengyu_time > 0) {
			long h = m_jbp_baohushengyu_time / GameManager.FRAME_PER_SECOND / 3600;
			long m = m_jbp_baohushengyu_time / GameManager.FRAME_PER_SECOND / 60 % 60;
			long s = m_jbp_baohushengyu_time / GameManager.FRAME_PER_SECOND % 60 % 60;
			g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_JBP][3]
					+ (h > 9 ? "" : "0") + h + ":" + (m > 9 ? "" : "0") + m
					+ ":" + (s > 9 ? "" : "0") + s, m_x + (m_w >> 1), MIDDLE_ONELINE_STRING_Y, Tools.HCENTER_TOP);
		}
//		g.drawString(DONGFU_MIDDLE_MSG[0]
//				+ (m_dongfu_jbp_needOver_num - m_dongfu_jbp_over_num)
//				+ DONGFU_MIDDLE_MSG[1] + (m_dongfu_jbp_grade + 1)
//				+ DONGFU_MIDDLE_MSG[2], AbstractGameScreen.SCREEN_WIDTH >> 1,
//				MIDDLE_ONELINE_STRING_Y, Tools.HCENTER_TOP);

	}

	/**
	 * 绘制八卦炉相关
	 * 
	 * @param g
	 */
	private void drawDongFuBGL(Graphics g)
	{
		g.setClip(X_MIDDLE_LABEL, Y_MIDDLE_LABEL, UITools.W_BUTTON_BIG,
				UITools.H_BUTTON);

		switch (m_dongfu_bgl_status) {
			case 0: // 祭练
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_BGL][m_dongfu_bgl_status],
						true);
				anim_bgl.draw(g, (AbstractGameScreen.SCREEN_WIDTH >> 1), anim_y,
						false, false, 0);
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_bgl_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_BGL][0] + m_dongfu_bgl_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_BGL][1],
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_BGL][0],
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
			case 1: // 生产中
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_BGL][m_dongfu_bgl_status],
						true);

				g.setClip(img_progressBar_x, img_progressBar_y, img_progressBar_w,
						img_progressBar_h);
				g.drawImage(img_progressBar, img_progressBar_x, img_progressBar_y,
						Tools.LEFT_TOP);
				if (m_dongfu_time_bgl_sum != 0) {
					g.setColor(Tools.RED);
					g.fillRect(
							img_progressBar_x + 7,
							img_progressBar_y + 3,
							((m_dongfu_time_bgl_sum - m_dongfu_bgl_time) * (img_progressBar_w - 14))
									/ m_dongfu_time_bgl_sum, 3);
				}
				actor_bgl.draw(g, 0, 0);
				actor_bgl.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(
						DONGFU_UP_MSG[DONGFU_LABEL_BGL][2] + m_dongfu_name_bgl,
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				int h = m_dongfu_bgl_time / GameManager.FRAME_PER_SECOND / 3600;
				int m = m_dongfu_bgl_time / GameManager.FRAME_PER_SECOND / 60 % 60;
				int s = m_dongfu_bgl_time / GameManager.FRAME_PER_SECOND % 60 % 60;
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_BGL][1]
						+ (h > 9 ? "" : "0") + h + ":" + (m > 9 ? "" : "0") + m
						+ ":" + (s > 9 ? "" : "0") + s,
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
			case 2:// 开炉
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_BGL][m_dongfu_bgl_status],
						true);
				actor_bgl.draw(g, 0, 0);
				actor_bgl.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_bgl_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_BGL][0] + m_dongfu_bgl_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_BGL][1],
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(m_dongfu_name_bgl
						+ DONGFU_DOWN_MSG[DONGFU_LABEL_BGL][2],
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
		}
	}

	/**
	 * 绘制天工坊相关
	 * 
	 * @param g
	 */
	private void drawDongFuTGF(Graphics g)
	{
		g.setClip(X_MIDDLE_LABEL, Y_MIDDLE_LABEL, UITools.W_BUTTON_BIG,
				UITools.H_BUTTON);
		switch (m_dongfu_tgf_status) {
			case 0: // 开工
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_TGF][m_dongfu_tgf_status],
						true);

				anim_tgf.draw(g, (AbstractGameScreen.SCREEN_WIDTH >> 1), anim_y,
						false, false, 0);
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_tgf_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_TGF][0] + m_dongfu_tgf_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_TGF][1],
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_TGF][0],
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
			case 1: // 生产中
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_TGF][m_dongfu_tgf_status],
						true);

				g.setClip(img_progressBar_x, img_progressBar_y, img_progressBar_w,
						img_progressBar_h);
				g.drawImage(img_progressBar, img_progressBar_x, img_progressBar_y,
						Tools.LEFT_TOP);
				if (m_dongfu_time_tgf_sum != 0) {
					g.setColor(Tools.RED);
					g.fillRect(
							img_progressBar_x + 7,
							img_progressBar_y + 3,
							((m_dongfu_time_tgf_sum - m_dongfu_tgf_time) * (img_progressBar_w - 14))
									/ m_dongfu_time_tgf_sum, 3);
				}
				actor_tgf.draw(g, 0, 0);
				actor_tgf.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(
						DONGFU_UP_MSG[DONGFU_LABEL_TGF][2] + m_dongfu_name_tgf,
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				int h = m_dongfu_tgf_time / GameManager.FRAME_PER_SECOND / 3600;
				int m = m_dongfu_tgf_time / GameManager.FRAME_PER_SECOND / 60 % 60;
				int s = m_dongfu_tgf_time / GameManager.FRAME_PER_SECOND % 60 % 60;
				g.drawString(DONGFU_DOWN_MSG[DONGFU_LABEL_TGF][1]
						+ (h > 9 ? "" : "0") + h + ":" + (m > 9 ? "" : "0") + m
						+ ":" + (s > 9 ? "" : "0") + s,
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
			case 2:// 收取
				drawLabel(g, X_MIDDLE_LABEL, Y_MIDDLE_LABEL,
						DONGFU_LABEL_STRING[DONGFU_LABEL_TGF][m_dongfu_tgf_status],
						true);

				actor_tgf.draw(g, 0, 0);
				actor_tgf.nextFrame();
				g.setColor(UIManager.getPaletteColor(UIPalette.COLOR_WORD_NOS));
				g.drawString(m_dongfu_tgf_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_TGF][0] + m_dongfu_tgf_grade
						+ DONGFU_UP_MSG[DONGFU_LABEL_TGF][1],
						AbstractGameScreen.SCREEN_WIDTH >> 1, UP_ONELINE_STRING_Y,
						Tools.HCENTER_TOP);
				g.drawString(m_dongfu_name_tgf
						+ DONGFU_DOWN_MSG[DONGFU_LABEL_TGF][2],
						AbstractGameScreen.SCREEN_WIDTH >> 1, DOWN_STRING_Y,
						Tools.HCENTER_TOP);
				break;
		}
//		g.drawString(DONGFU_MIDDLE_MSG[0]
//				+ (m_dongfu_tgf_needOver_num - m_dongfu_tgf_over_num)
//				+ DONGFU_MIDDLE_MSG[1] + (m_dongfu_tgf_grade + 1)
//				+ DONGFU_MIDDLE_MSG[2], AbstractGameScreen.SCREEN_WIDTH >> 1,
//				MIDDLE_ONELINE_STRING_Y, Tools.HCENTER_TOP);
	}

	/**
	 * 绘制配方界面
	 * isXnum 是否显示个数
	 * @param g
	 */
	private void drawDongWateringList(Graphics g, ArrayList list, String lableName)
	{
		g.setClip(DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y,
				DONGFU_UIPEIFANG_FREAM_W, DONGFU_UIPEIFANG_FREAM_H - 1);
		for (int i = m_dongfu_paifang_currentPage * m_dongfu_paifang_onePage_howLine; i < ((m_dongfu_paifang_currentPage == (m_dongfu_paifang_sumPage - 1) ? list
				.size()
				: (m_dongfu_paifang_currentPage + 1) * m_dongfu_paifang_onePage_howLine)); i++) {
			SimpleRole item = (SimpleRole) list.elementAt(i);
			g.setColor(Tools.YELLOW);
			g.drawString(item.m_name, DONGFU_UIPEIFANG_FREAM_X + 2,
					DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i % m_dongfu_paifang_onePage_howLine) + 3,
					Graphics.LEFT | Graphics.TOP);
			g.drawString(item.m_WateringTime, AbstractGameScreen.SCREEN_WIDTH >> 1,
					DONGFU_UIPEIFANG_FREAM_Y + 2 + LIST_RECT_H * (i % m_dongfu_paifang_onePage_howLine) + 3,
					Graphics.LEFT | Graphics.TOP);

//			if (i == m_dongfu_peifang_currentindex) {
//				g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH, AbstractGameScreen.SCREEN_HEIGHT);
//				UITools.drawSelectBox(g, DONGFU_UIPEIFANG_FREAM_X, DONGFU_UIPEIFANG_FREAM_Y + LIST_RECT_H
//						* (i % m_dongfu_paifang_onePage_howLine), DONGFU_UIPEIFANG_FREAM_W, LIST_RECT_H);
//			}
		}
		drawDongFuSubclassUILable(g, lableName);
		// 绘制翻页
		g.setClip(AbstractGameScreen.SCREEN_WIDTH / 2 - 10, DONGFU_UIPEIFANG_FREAM_Y
				+ LIST_RECT_H, 20, 20);
		UITools.paintPage(g, m_x + (m_w >> 1), m_y + m_h - UITools.IW_WIN,
				m_dongfu_paifang_currentPage, m_dongfu_paifang_sumPage);
	}

	/**
	 * 绘制工具未开放
	 * 
	 * @param g
	 */
	private void drawNotOpen(Graphics g)
	{
		g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH,
				AbstractGameScreen.SCREEN_HEIGHT);
		UITools.drawColorString(g, "通过20级任务开放",
				AbstractGameScreen.SCREEN_WIDTH >> 1,
				AbstractGameScreen.SCREEN_HEIGHT >> 1, Tools.YELLOW,
				Tools.HCENTER_TOP);
//		UITools.drawColorString(g, "具体级数待确定",
//				AbstractGameScreen.SCREEN_WIDTH >> 1,
//				AbstractGameScreen.SCREEN_HEIGHT >> 1 + 20, Tools.YELLOW,
//				Tools.HCENTER_TOP);
	}

	/**
	 * 绘制工具未开放聚寶盆
	 * 
	 * @param g
	 */
	private void drawNotOpenJBP(Graphics g)
	{
		g.setClip(0, 0, AbstractGameScreen.SCREEN_WIDTH,
				AbstractGameScreen.SCREEN_HEIGHT);
		UITools.drawColorString(g, "通过25级任务开放",
				AbstractGameScreen.SCREEN_WIDTH >> 1,
				AbstractGameScreen.SCREEN_HEIGHT >> 1, Tools.YELLOW,
				Tools.HCENTER_TOP);
//		UITools.drawColorString(g, "具体级数待确定",
//				AbstractGameScreen.SCREEN_WIDTH >> 1,
//				AbstractGameScreen.SCREEN_HEIGHT >> 1 + 20, Tools.YELLOW,
//				Tools.HCENTER_TOP);
	}

	/**
	 * 绘制洞府标题标签
	 * 
	 * @param g
	 */
	private void drawDongFuLabel(Graphics g)
	{
		int currentindex = 0;
		if (m_openDongFuLableNUm == 4) {

			switch (m_dongfu_label_currentindex) {
				case 0:
					currentindex = 0;
					break;
				case 1:
					currentindex = 0;
					break;
				case 2:
					currentindex = 1;
					break;
				case 3:
					currentindex = 1;
					break;
			}
		}
		g.setClip(m_x + ((m_w - UITools.W_BUTTON_BIG * DONGFU_LABEL_PAGE) >> 1), UITools.Y_BUTTON, UITools.W_BUTTON_BIG
				* DONGFU_LABEL_PAGE, UITools.H_BUTTON);
		int x;
		for (int i = 0; i < (DONGFU_LABEL_PAGE + 1); i++) {
			x = (m_x + ((m_w - UITools.W_BUTTON_BIG * DONGFU_LABEL_PAGE) >> 1) + UITools.W_BUTTON_BIG
					* (i - currentindex));
			if (i < m_openDongFuLableNUm) {
				byte item = ((Byte) m_openDongFuLable.elementAt(i)).byteValue();
				drawLabel(g, x, UITools.Y_BUTTON, DONGFU_LABEL[item],
						m_dongfu_label_currentindex == i);
			}
			else {
				drawLabel(g, x, UITools.Y_BUTTON, DONGFU_LABEL[4], false, false);
			}
		}
	}

	private boolean m_dongfu_is_self; // 是不是自己的洞府
	private long m_jbp_baohushengyu_time = -1;//聚宝盆保护剩余时间

	/**
	 * 查看洞府界面信息
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvSeedDongFuInfo(DataInputStream dis)
			throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); // 状态
		// String msg = dis.readUTF(); //状态信息
		Tools.debugPrintln("进入洞府status : " + status);
		// Tools.debugPrintln("读取洞府界面信息：" + msg);
		if (status == 0) {
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "您的洞府尚未开放");
			return;
		}
		UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
				.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
		if (uiCaveWorld == null) {
			uiCaveWorld = (UICaveWorldWindow) UIManager.getInstance()
					.createWindow(UIWindowFactory.WINDOW_ID_DONGFU);
		}
		synchronized (uiCaveWorld) {
			uiCaveWorld.m_currentDongFuPlayerID = dis.readLong(); // 洞府所属玩家id
			if (uiCaveWorld.m_currentDongFuPlayerID == GameManager
					.getInstance().m_role.m_gameID) {
				uiCaveWorld.m_dongfu_is_self = true;
			}
			else {
				uiCaveWorld.m_dongfu_is_self = false;
			}
			uiCaveWorld.m_currentDongFuID = dis.readLong(); // 当前洞府id
			// uiCaveWorld.m_currentDongFuPlayerName = dis.readUTF();//洞府所属玩家名字

			// 摇钱树
			uiCaveWorld.m_dongfu_yqs_status = dis.readByte();
			if (uiCaveWorld.m_dongfu_yqs_status == -1) {

			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 1) {
				uiCaveWorld.m_dongfu_yqs_grade = dis.readByte(); // 摇钱树等级
				uiCaveWorld.m_dongfu_yqs_gradeMax = dis.readByte(); // 摇钱树最大等级
				uiCaveWorld.m_dongfu_yqs_over_num = dis.readShort(); // 已完成次数
				uiCaveWorld.m_dongfu_yqs_needOver_num = dis.readShort(); // 需要完成的次数
				uiCaveWorld.m_dongfu_number_yqs = dis.readShort(); // 摇钱树生产的数量

				uiCaveWorld.m_dongfu_jiaoguang_sum = dis.readByte(); // 总共浇灌次数
				uiCaveWorld.m_dongfu_jiaoguang_number = dis.readByte(); // 已经浇灌次数
				uiCaveWorld.m_dongfu_is_jiaoguang = dis.readByte(); // 自己是否能浇灌
			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 2
					|| uiCaveWorld.m_dongfu_yqs_status == 3) {
				uiCaveWorld.m_dongfu_yqs_grade = dis.readByte(); // 摇钱树等级
				uiCaveWorld.m_dongfu_yqs_gradeMax = dis.readByte(); // 摇钱树最大等级
				uiCaveWorld.m_dongfu_yqs_over_num = dis.readShort(); // 已完成次数
				uiCaveWorld.m_dongfu_yqs_needOver_num = dis.readShort(); // 需要完成的次数
				uiCaveWorld.m_dongfu_number_yqs = dis.readShort(); // 摇钱树生产的数量
			}
			if (uiCaveWorld.m_dongfu_yqs_status == 1) {
				uiCaveWorld.actor_yqs.setAction(1, true, true);
			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 2) {
				uiCaveWorld.actor_yqs.setAction(2, true, true);
			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 3) {
				uiCaveWorld.actor_yqs.setAction(0, true, true);
			}

			// 聚宝盆
			uiCaveWorld.m_dongfu_jbp_status = dis.readByte();
			if (uiCaveWorld.m_dongfu_jbp_status == -1) {

			}
			else if (uiCaveWorld.m_dongfu_jbp_status == 1
					|| uiCaveWorld.m_dongfu_jbp_status == 2) {
				long daoqiTime = dis.readLong(); //聚宝盆免战到期时
				long currenttime = System.currentTimeMillis() / 1000;
				if (currenttime < daoqiTime) {
					uiCaveWorld.m_jbp_baohushengyu_time = (daoqiTime - currenttime) * GameManager.FRAME_PER_SECOND; //聚宝盆保护剩余时间
					uiCaveWorld.startDongfuJBPBaohuTime(true);
				}

				uiCaveWorld.m_dongfu_jbp_grade = dis.readByte(); // 集宝盆等级
				uiCaveWorld.m_dongfu_jbp_gradeMax = dis.readByte(); // 聚宝盆最大等级
				uiCaveWorld.m_dongfu_jbp_over_num = dis.readShort(); // 完成次数
				uiCaveWorld.m_dongfu_jbp_needOver_num = dis.readShort(); // 需要完成次数
				uiCaveWorld.m_dongfu_jbp_multiple = dis.readShort(); // 当前等级生产的倍数
				uiCaveWorld.m_dongfu_time_jbp_sum = dis.readInt() * GameManager.FRAME_PER_SECOND; // 共需时间

				uiCaveWorld.m_dongfu_jbp_current_multiple = dis.readShort(); // 当前实际生产的倍数
				uiCaveWorld.m_dongfu_key_jbp = dis.readUTF(); // 聚宝盆当前生产物品的key
				uiCaveWorld.m_dongfu_name_jbp = dis.readUTF(); // 聚宝盆当前生产物品的name

				uiCaveWorld.m_dongfu_time_jbp_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND; // 剩余时间
				uiCaveWorld.startDongFuJBPTime(true, uiCaveWorld.m_dongfu_time_jbp_surplus);

			}
			else if (uiCaveWorld.m_dongfu_jbp_status == 0) {
				long daoqiTime = dis.readLong(); //聚宝盆到期时
				long currenttime = System.currentTimeMillis() / 1000;
				if (currenttime < daoqiTime) {
					uiCaveWorld.m_jbp_baohushengyu_time = (daoqiTime - currenttime) * GameManager.FRAME_PER_SECOND; //聚宝盆保护剩余时间
					uiCaveWorld.startDongfuJBPBaohuTime(true);
				}

				uiCaveWorld.m_dongfu_jbp_grade = dis.readByte(); // 集宝盆等级
				uiCaveWorld.m_dongfu_jbp_gradeMax = dis.readByte(); // 聚宝盆最大等级
				uiCaveWorld.m_dongfu_jbp_over_num = dis.readShort(); // 完成次数
				uiCaveWorld.m_dongfu_jbp_needOver_num = dis.readShort(); // 需要完成次数
				uiCaveWorld.m_dongfu_jbp_multiple = dis.readShort(); // 当前等级生产的倍数
				uiCaveWorld.m_dongfu_time_jbp_sum = dis.readInt() * GameManager.FRAME_PER_SECOND; // 共需时间

			}
			if (uiCaveWorld.m_dongfu_jbp_status == 0) {
				uiCaveWorld.actor_jbp.setAction(0, true, true);
			}
			else if (uiCaveWorld.m_dongfu_jbp_status == 1) {
				uiCaveWorld.actor_jbp.setAction(1, true, true);
			}
			else if (uiCaveWorld.m_dongfu_jbp_status == 2) {
				uiCaveWorld.actor_jbp.setAction(2, true, true);
			}

			// 八卦炉
			uiCaveWorld.m_dongfu_bgl_status = dis.readByte();
			if (uiCaveWorld.m_dongfu_bgl_status == -1) {

			}
			else if (uiCaveWorld.m_dongfu_bgl_status == 1
					|| uiCaveWorld.m_dongfu_bgl_status == 2) {
				uiCaveWorld.m_dongfu_bgl_grade = dis.readByte(); // 八卦炉等级
				uiCaveWorld.m_dongfu_bgl_gradeMax = dis.readByte(); // 八卦炉最大等级
				uiCaveWorld.m_dongfu_bgl_over_num = dis.readShort(); // 完成次数
				uiCaveWorld.m_dongfu_bgl_needOver_num = dis.readShort(); // 需要完成次数

				uiCaveWorld.m_dongfu_number_bgl = dis.readShort(); // 八卦炉正在炼的数量
				uiCaveWorld.m_dongfu_key_bgl = dis.readUTF(); // 八卦炉正在炼的物品的key
				byte numItem = dis.readByte(); // 物品名数量
				String names = "";
				for (int i = 0; i < numItem; i++) {
					if (i == 0) {
						names = names + dis.readUTF(); // 八卦炉正在炼的物品的name
					}
					else {
						names = names + "," + dis.readUTF(); // 八卦炉正在炼的物品的name
					}
				}
				uiCaveWorld.m_dongfu_name_bgl = names;
				uiCaveWorld.m_dongfu_time_bgl_sum = dis.readInt()
						* GameManager.FRAME_PER_SECOND; // 共需时间
				uiCaveWorld.m_dongfu_time_bgl_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND; // 剩余时间
				uiCaveWorld.startDongFuBGLTime(true,
						uiCaveWorld.m_dongfu_time_bgl_surplus);
			}
			else if (uiCaveWorld.m_dongfu_bgl_status == 0) {
				uiCaveWorld.m_dongfu_bgl_grade = dis.readByte(); // 八卦炉等级
				uiCaveWorld.m_dongfu_bgl_gradeMax = dis.readByte(); // 八卦炉最大等级
				uiCaveWorld.m_dongfu_bgl_over_num = dis.readShort(); // 完成次数
				uiCaveWorld.m_dongfu_bgl_needOver_num = dis.readShort(); // 需要完成次数
			}
			// 天工坊
			uiCaveWorld.m_dongfu_tgf_status = dis.readByte();
			if (uiCaveWorld.m_dongfu_tgf_status == -1) {

			}
			else if (uiCaveWorld.m_dongfu_tgf_status == 1
					|| uiCaveWorld.m_dongfu_tgf_status == 2) {
				uiCaveWorld.m_dongfu_tgf_grade = dis.readByte(); // 天工坊等级
				uiCaveWorld.m_dongfu_tgf_gradeMax = dis.readByte(); // 天工坊最大等级
				uiCaveWorld.m_dongfu_tgf_over_num = dis.readShort();
				uiCaveWorld.m_dongfu_tgf_needOver_num = dis.readShort();

				uiCaveWorld.m_dongfu_number_tgf = dis.readShort(); // 正在炼制的数量
				uiCaveWorld.m_dongfu_key_tgf = dis.readUTF(); // 天工坊正在制作物品 key
				byte numItem = dis.readByte(); // 物品名数量
				String names = "";
				for (int i = 0; i < numItem; i++) {
					if (i == 0) {
						names = names + dis.readUTF(); // 天工坊正在制作的物品的name
					}
					else {
						names = names + "," + dis.readUTF(); // 天工坊正在制作的物品的name				
					}
				}
				uiCaveWorld.m_dongfu_name_tgf = names;
				uiCaveWorld.m_dongfu_time_tgf_sum = dis.readInt()
						* GameManager.FRAME_PER_SECOND; // 共需时间
				uiCaveWorld.m_dongfu_time_tgf_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND; // 剩余时间
				uiCaveWorld.startDongFuTGFTime(true,
						uiCaveWorld.m_dongfu_time_tgf_surplus);
			}
			else if (uiCaveWorld.m_dongfu_tgf_status == 0) {
				uiCaveWorld.m_dongfu_tgf_grade = dis.readByte(); // 天工坊等级
				uiCaveWorld.m_dongfu_tgf_gradeMax = dis.readByte(); // 天工坊最大等级
				uiCaveWorld.m_dongfu_tgf_over_num = dis.readShort();
				uiCaveWorld.m_dongfu_tgf_needOver_num = dis.readShort();
			}
			uiCaveWorld.m_openDongFuLable.removeAllElements();
			if (uiCaveWorld.m_dongfu_yqs_status != -1) {
				uiCaveWorld.m_openDongFuLable.addElement(new Byte(uiCaveWorld.DONGFU_LABEL_YQS));
			}
			if (uiCaveWorld.m_dongfu_jbp_status != -1) {
				uiCaveWorld.m_openDongFuLable.addElement(new Byte(uiCaveWorld.DONGFU_LABEL_JBP));
			}
			if (uiCaveWorld.m_dongfu_bgl_status != -1) {
				uiCaveWorld.m_openDongFuLable.addElement(new Byte(uiCaveWorld.DONGFU_LABEL_BGL));
			}
			if (uiCaveWorld.m_dongfu_tgf_status != -1) {
				uiCaveWorld.m_openDongFuLable.addElement(new Byte(uiCaveWorld.DONGFU_LABEL_TGF));
			}
			uiCaveWorld.m_openDongFuLableNUm = uiCaveWorld.m_openDongFuLable.size();
		}
	}

	/**
	 * 退出洞府
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvOutDongFu(DataInputStream dis) throws IOException
	{
		short status = dis.readShort(); // 状态
		String msg = dis.readUTF(); // 状态信息
		Tools.debugPrintln("退出洞府status:" + status);
		Tools.debugPrintln("退出洞府msg:" + msg);
	}

	private static UICaveWorldWindow uiCaveWorldReap = null;

	/**
	 * 收获道具
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvReapDongFu(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		short status = dis.readShort(); // 状态
		String msg = dis.readUTF();// 收到物品名和数量
		Tools.debugPrintln("收获道具status:" + status);
		Tools.debugPrintln("收获道具msg:" + msg);
		uiCaveWorldReap = (UICaveWorldWindow) UIManager
				.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
		if (uiCaveWorldReap == null) {
			return;
		}
		String tsMsg = msg;
		if (status == 1) {
			final byte dongFuType = dis.readByte();
			if (uiCaveWorldReap == null) {
				return;
			}
			int jbpshijiNum = 0; //集宝盆实际收货数量
			if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_YQS) {
				dis.readInt();
				uiCaveWorldReap.m_dongfu_yqs_grade = dis.readByte();
				uiCaveWorldReap.m_dongfu_yqs_needOver_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_yqs_over_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_number_yqs = dis.readShort();
				uiCaveWorldReap.m_dongfu_yqs_status = 3;

				uiCaveWorldReap.actor_yqs.setAction(0, true, true);
			}
			else if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_JBP) {
				jbpshijiNum = dis.readInt();

				if (jbpshijiNum < uiCaveWorldReap.m_dongfu_jbp_multiple) {
					tsMsg = "由于您的洞府被攻伐了，只收获了" + jbpshijiNum + "份" + uiCaveWorldReap.m_dongfu_name_jbp;
				}
				else {
					tsMsg = "聚宝完成，您收获了" + jbpshijiNum + "份" + uiCaveWorldReap.m_dongfu_name_jbp;
				}
				uiCaveWorldReap.m_dongfu_jbp_grade = dis.readByte();
				uiCaveWorldReap.m_dongfu_jbp_needOver_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_jbp_over_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_jbp_multiple = dis.readShort();
				uiCaveWorldReap.m_dongfu_jbp_current_multiple = uiCaveWorldReap.m_dongfu_jbp_multiple;
				uiCaveWorldReap.m_dongfu_time_jbp_sum = dis.readInt() * GameManager.FRAME_PER_SECOND;
				uiCaveWorldReap.m_dongfu_jbp_status = 0;

				uiCaveWorldReap.actor_jbp.setAction(0, true, true);
			}
			else if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_BGL) {
				dis.readInt();
				uiCaveWorldReap.m_dongfu_bgl_grade = dis.readByte();
				uiCaveWorldReap.m_dongfu_bgl_needOver_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_bgl_over_num = dis.readShort();
				short num1 = dis.readShort();
				uiCaveWorldReap.m_dongfu_bgl_status = 0;
			}
			else if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_TGF) {
				dis.readInt();
				uiCaveWorldReap.m_dongfu_tgf_grade = dis.readByte();
				uiCaveWorldReap.m_dongfu_tgf_needOver_num = dis.readShort();
				uiCaveWorldReap.m_dongfu_tgf_over_num = dis.readShort();
				short num2 = dis.readShort();
				uiCaveWorldReap.m_dongfu_tgf_status = 0;
			}

			final UIMessageBox msgbox = (UIMessageBox) UIManager.getInstance()
					.createWindow(UIWindowFactory.WINDOW_MESSAGEBOX);
			msgbox.setMessage(null, "确定", null, tsMsg);
			msgbox.addListener(new UIListener() {
				public void actionPerformed()
				{
					if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
							|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
						UIManager.getInstance().removeWindow(msgbox);
						if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_YQS
									&& uiCaveWorldReap.m_dongfu_jbp_grade == 1
									&& (uiCaveWorldReap.m_dongfu_yqs_over_num == 1 || uiCaveWorldReap.m_dongfu_yqs_over_num == 2)) {
							final UIMessageBox tstbox = (UIMessageBox) UIManager.getInstance()
														.createWindow(UIWindowFactory.WINDOW_MESSAGEBOX);
							tstbox.setMessage(null, "确定", "返回", "获得银票后，可以去商城购买各种神秘道具喽！");
							tstbox.addListener(new UIListener() {

								public void actionPerformed()
								{
									if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
												|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
										GameManager.getInstance().m_game_message.sendOpenMarket();
										UIManager.getInstance().removeWindow(tstbox);
									}
									else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
										UIManager.getInstance().removeWindow(tstbox);
									}
								}
							});
						}
					}
				}
			});
		}
		else if (status == 2) {
			byte dongFuType = dis.readByte();
			if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_JBP) {
				uiCaveWorldReap.m_dongfu_time_jbp_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND / 60; // 剩余时间
				uiCaveWorldReap.startDongFuJBPTime(true,
						uiCaveWorldReap.m_dongfu_time_jbp_surplus);
				uiCaveWorldReap.m_dongfu_jbp_status = 1;
			}
			else if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_BGL) {
				uiCaveWorldReap.m_dongfu_time_bgl_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND / 60; // 剩余时间
				uiCaveWorldReap.startDongFuBGLTime(true,
						uiCaveWorldReap.m_dongfu_time_bgl_surplus);
				uiCaveWorldReap.m_dongfu_bgl_status = 1;
			}
			else if (dongFuType == uiCaveWorldReap.DONGFU_LABEL_TGF) {
				uiCaveWorldReap.m_dongfu_time_tgf_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND / 60; // 剩余时间
				uiCaveWorldReap.startDongFuTGFTime(true, uiCaveWorldReap.m_dongfu_time_tgf_surplus);
				uiCaveWorldReap.m_dongfu_tgf_status = 1;
			}
		}
		else if (status == 0) {

			final UIMessageBox msgbox = (UIMessageBox) UIManager.getInstance()
					.createWindow(UIWindowFactory.WINDOW_MESSAGEBOX);
			msgbox.setMessage(tsMsg);
			msgbox.addListener(new UIListener() {
				public void actionPerformed()
									{
										if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
												|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
											UIManager.getInstance().removeWindow(msgbox);
										}
										else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
											UIManager.getInstance().removeWindow(msgbox);
										}
									}
			});

		}
		else if (status == 3) {

		}
		else if (status == 4) {

		}
		else if (status == 5) {
			final UIMessageBox msgbox = (UIMessageBox) UIManager.getInstance()
					.createWindow(UIWindowFactory.WINDOW_MESSAGEBOX);
			msgbox.setMessage(null, "确定", "返回", "您的洞府正在被攻伐，请稍后重试！");
			msgbox.addListener(new UIListener() {
				public void actionPerformed()
									{
										if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_LEFT_SOFT)
												|| AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_A)) {
											UIManager.getInstance().removeWindow(msgbox);
										}
										else if (AbstractGameScreen.haveKeyPressed(AbstractGameScreen.GK_RIGHT_SOFT)) {
											UIManager.getInstance().removeWindow(msgbox);
										}
									}
			});
		}
	}

	/**
	 * 得到生产道具信息
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvGetPropMsg(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		short status = dis.readShort(); // 状态
		String msg = dis.readUTF(); // 状态信息
		Tools.debugPrintln("得到生产道具信息status:" + status);
		Tools.debugPrintln("得到生产道具信息msg:" + msg);
		if (status == 0) {
			return;
		}
		UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
				.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
		if (uiCaveWorld == null) {
			return;
		}
		uiCaveWorld.m_index_dongfu_peifang = 0;
		uiCaveWorld.m_index_dongfu_start = 0;
		uiCaveWorld.m_dongfu_need_Prop.removeAllElements();
		uiCaveWorld.m_need_vim = dis.readInt();// 消耗的精力
		uiCaveWorld.m_need_gread = dis.readInt(); // 需要的等级

		uiCaveWorld.m_dongfu_get_Prop.removeAllElements();
		byte itemNum = ((Byte) uiCaveWorld.m_openDongFuLable.elementAt(uiCaveWorld.m_dongfu_label_currentindex))
				.byteValue();
		if (itemNum == uiCaveWorld.DONGFU_LABEL_JBP) {
			uiCaveWorld.m_dongfu_time_jbp_sum = dis.readInt()
					* GameManager.FRAME_PER_SECOND;
		}
		else if (itemNum == uiCaveWorld.DONGFU_LABEL_BGL) {
			uiCaveWorld.m_dongfu_time_bgl_sum = dis.readInt()
					* GameManager.FRAME_PER_SECOND;
		}
		else if (itemNum == uiCaveWorld.DONGFU_LABEL_TGF) {
			uiCaveWorld.m_dongfu_time_tgf_sum = dis.readInt() * GameManager.FRAME_PER_SECOND;
		}
		int needPropTypeNum = dis.readInt(); // 所需道具的类型数量
		for (int i = 0; i < needPropTypeNum; i++) {
			ActorItem item = new ActorItem();
			item.m_key = dis.readUTF(); // 道具KEY
			item.m_name = dis.readUTF(); // 道具的名字
			item.m_iconId = dis.readShort(); //
			item.m_iconCoverId = dis.readShort(); //
			item.m_num = dis.readInt();// 所需道具的数量
			uiCaveWorld.m_dongfu_need_Prop.addElement(item);
		}
		int getPropTypeNum = dis.readInt();// 要获得道具的类型数量
		for (int i = 0; i < getPropTypeNum; i++) {
			ActorItem item = new ActorItem();
			item.m_key = dis.readUTF(); // 道具KEY
			item.m_name = dis.readUTF(); // 道具的名字
			item.m_iconId = dis.readShort(); //
			item.m_iconCoverId = dis.readShort(); //
			item.m_num = dis.readInt();// 所获得道具的数量
			uiCaveWorld.m_dongfu_get_Prop.addElement(item);
		}
		uiCaveWorld.gettStuffList();
//		uiCaveWorld.m_max_prodctionNum = uiCaveWorld
//				.getmaxProductionNum(uiCaveWorld.m_dongfu_need_Prop);
//		uiCaveWorld.m_need_prodction = uiCaveWorld.m_max_prodctionNum;
		//配方所需材料是否齐全
		uiCaveWorld.m_StuffIsEnough = uiCaveWorld.getStuffIsEnough();
		uiCaveWorld.DONGFU_UI_CURRENT = uiCaveWorld.DONGFU_UISTUFF; // 进入材料界面
		uiCaveWorld.m_dongfu_peifang_currentindex = 0;
	}

	/**
	 * 攻伐返回
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongFuGongFa(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); // 状态
		long nexttime = dis.readLong(); //距离下次攻伐的时间
		int spaceTime = dis.readInt(); //功伐间隔时间 s
		switch (status) {
			case 0: //失败
				Tools.debugPrintln("攻伐失败");
				break;
			case 1: //成功
				Tools.debugPrintln("攻伐成功");
				break;
			case 2: //自己没有洞府，无法攻伐
				Tools.debugPrintln("自己没有洞府，无法攻伐");
				break;
			case 3: //没有攻伐剩余次数
				Tools.debugPrintln("没有攻伐剩余次数");
				GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_D, "没有攻伐剩余次数");
				break;
			case 4: //离上一次攻伐时间间隔太短
//				Tools.debugPrintln("离上一次攻伐时间间隔太短");
				if (spaceTime > 0) {
					long h = spaceTime / 3600;
					long m = spaceTime / 60 % 60;
					String gfmsg;
					if (h > 0) {
						gfmsg = "离上一次攻伐时间间隔太短,请再过" + h + "小时" + m + "分钟后再攻伐";
					}
					else {
						if (h == 0 && m == 0 && spaceTime > 0) {
							m = 1;
						}
						gfmsg = "离上一次攻伐时间间隔太短,请再过" + m + "分钟后再攻伐";
					}
					GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_D, gfmsg);
				}
				break;
			case 5:
				Tools.debugPrintln("目标洞府不存在");
				GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_D, "目标洞府不存在");
				break;
			case 6:
				Tools.debugPrintln("目标洞府无法攻伐");
				GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_D, "目标洞府无法攻伐");
				break;
			case 7:
				Tools.debugPrintln("目标洞府正在被攻伐中");
				GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_D, "目标洞府正在被攻伐中");
				break;
		}
	}

	/**
	 * 查看攻伐记录
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongFuGongFaMSG(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); //状态0：失败 1：成功
		if (status == 0) {
			return;
		}
		int ssNum = dis.readInt(); //被攻伐掉的数目
		byte pNum = dis.readByte(); //人数
		UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
				.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
		if (uiCaveWorld == null) {
			return;
		}
		uiCaveWorld.m_GongFaMsg = new StringBuffer();
		for (int i = 0; i < pNum; i++) {
			String name = dis.readUTF();
			byte gongfaStatus = dis.readByte();
			if (gongfaStatus == 0) { //失败
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa1);
				uiCaveWorld.m_GongFaMsg.append(name);
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa2);
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa4);
			}
			else if (gongfaStatus == 1) {
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa1);
				uiCaveWorld.m_GongFaMsg.append(name);
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa3);
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_dongfu_name_jbp);
				uiCaveWorld.m_GongFaMsg.append("x" + ssNum);
				uiCaveWorld.m_GongFaMsg.append(uiCaveWorld.m_GongFa4);
			}
		}
		if (pNum > 0) {
			uiCaveWorld.m_GongFaMsgStringList = Tools.splitString(uiCaveWorld.m_GongFaMsg.toString(),
					AbstractGameScreen.s_font, '|', uiCaveWorld.m_dongfuMsg_W);
		}
		else {
			uiCaveWorld.m_GongFaMsgStringList = new String[] { "" };
		}
		uiCaveWorld.DONGFU_UI_CURRENT = uiCaveWorld.DONGFU_UISTUFF; // 进入材料界面
	}

	/**
	 * 配方所需材料是否齐全
	 * @return
	 */
	public boolean getStuffIsEnough()
	{
		int size = m_dongfu_need_Prop.size();
		for (int i = 0; i < size; i++) {
			ActorItem item = (ActorItem) m_dongfu_need_Prop.elementAt(i);
			if (m_bag_prop_nums[i] < item.m_num) {
				return false;
			}
		}
		if (m_need_vim > GameManager.getInstance().m_role.m_jinglizhi_shengyu) {
			return false;
		}
		return true;
	}

	/**
	 * 开始生产
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongFuStartProduction(DataInputStream dis)
			throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
				.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
		if (uiCaveWorld == null) {
			return;
		}
		short status = dis.readShort(); // 状态
		if (status == 0) {
			return;
		}
		byte dongfustatus = dis.readByte(); //洞府类型
		switch (dongfustatus) {
			case 0:
				dis.readShort();
				break;
			case 1:
				uiCaveWorld.m_dongfu_jbp_current_multiple = dis.readShort();
				break;
			case 2:
				dis.readShort();
				break;
			case 3:
				dis.readShort();
				break;
		}
		String msg = dis.readUTF();// 状态信息
		Tools.debugPrintln("开始生产status:" + status);
		Tools.debugPrintln("开始生产msg:" + msg);
		if (status == 1) {
			int nameSize = uiCaveWorld.m_dongfu_get_Prop.size();
			String names = "";
			for (int i = 0; i < nameSize; i++) {
				ActorItem item = (ActorItem) uiCaveWorld.m_dongfu_get_Prop
						.elementAt(i);
				if (i == 0) {
					names = names + item.m_name; // 八卦炉正在炼的物品的name
				}
				else {
					names = names + "," + item.m_name; // 八卦炉正在炼的物品的name
				}
			}
			if (dongfustatus == uiCaveWorld.DONGFU_LABEL_JBP) {
				uiCaveWorld.m_dongfu_jbp_status = 1;
				uiCaveWorld.m_dongfu_time_jbp_surplus = 0;
				uiCaveWorld.startDongFuJBPTime(true, uiCaveWorld.m_dongfu_time_jbp_sum);
				uiCaveWorld.m_dongfu_key_jbp = uiCaveWorld.m_current_map_key;
				// uiCaveWorld.m_dongfu_number_jbp =
				// uiCaveWorld.m_need_prodction;
			}
			else if (dongfustatus == uiCaveWorld.DONGFU_LABEL_BGL) {
				uiCaveWorld.m_dongfu_bgl_status = 1;
				uiCaveWorld.m_dongfu_time_bgl_surplus = 0;
				uiCaveWorld.startDongFuBGLTime(true, uiCaveWorld.m_dongfu_time_bgl_sum);
				uiCaveWorld.m_dongfu_name_bgl = names;
				uiCaveWorld.m_dongfu_key_bgl = uiCaveWorld.m_current_map_key;
				uiCaveWorld.m_dongfu_number_bgl = uiCaveWorld.m_need_prodction;
			}
			else if (dongfustatus == uiCaveWorld.DONGFU_LABEL_TGF) {
				uiCaveWorld.m_dongfu_tgf_status = 1;
				uiCaveWorld.m_dongfu_time_tgf_surplus = 0;
				uiCaveWorld.startDongFuTGFTime(true, uiCaveWorld.m_dongfu_time_tgf_sum);
				uiCaveWorld.m_dongfu_name_tgf = names;
				uiCaveWorld.m_dongfu_key_tgf = uiCaveWorld.m_current_map_key;
				uiCaveWorld.m_dongfu_number_tgf = uiCaveWorld.m_need_prodction;
			}
			uiCaveWorld.DONGFU_UI_CURRENT = uiCaveWorld.DONGFU_UIMAIN;
		}
	}

	/**
	 * 加速道具使用返回
	 * 
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongFuAddSpeed(DataInputStream dis)
			throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		short status = dis.readShort(); // 状态
		String msg = dis.readUTF();// 状态信息
		Tools.debugPrintln("加速道具status:" + status);
		Tools.debugPrintln("加速道具msg:" + msg);
		if (status == 1) {
			UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
					.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
			if (uiCaveWorld == null) {
				return;
			}
			byte itemNum = ((Byte) uiCaveWorld.m_openDongFuLable.elementAt(uiCaveWorld.m_dongfu_label_currentindex))
					.byteValue();
			if (itemNum == uiCaveWorld.DONGFU_LABEL_JBP) {
				uiCaveWorld.m_dongfu_time_jbp_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND;
				uiCaveWorld.startDongFuJBPTime(true,
						uiCaveWorld.m_dongfu_time_jbp_surplus);
			}
			else if (itemNum == uiCaveWorld.DONGFU_LABEL_BGL) {
				uiCaveWorld.m_dongfu_time_bgl_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND;
				uiCaveWorld.startDongFuBGLTime(true,
						uiCaveWorld.m_dongfu_time_bgl_surplus);
			}
			else if (itemNum == uiCaveWorld.DONGFU_LABEL_TGF) {
				uiCaveWorld.m_dongfu_time_tgf_surplus = dis.readInt()
						* GameManager.FRAME_PER_SECOND;
				uiCaveWorld.startDongFuTGFTime(true,
						uiCaveWorld.m_dongfu_time_tgf_surplus);
			}
		}
	}

	public static void recvDongFuWatering(DataInputStream dis)
			throws IOException
	{
//		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); // 状态
		Tools.debugPrintln("摇钱树浇灌放回 status  :" + status);
		if (status == 1) {
			byte yqsStatus = dis.readByte();// 摇钱树状态
			byte jiaoguangNUm = dis.readByte();
			long m_id = dis.readLong(); //玩家id
			if (m_id != GameManager.getInstance().m_role.m_gameID) {
				UISocialWindow uiFriend = (UISocialWindow) UIManager
						.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_SOCIAL_FRIEND);
				if (uiFriend != null) {
					Vector listFriend = GameManager.getInstance().m_social_list;
					if (listFriend != null && listFriend.size() != 0) {
						int friendSize = listFriend.size();
						for (int i = 0; i < friendSize; i++) {
							SimpleRole role = (SimpleRole) listFriend.elementAt(i);
							if (role.m_gameID == m_id) {
								role.m_isWatering = 1; //已浇过水
							}
						}
					}
				}
			}
			UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
					.getInstance().getWindowById(
							UIWindowFactory.WINDOW_ID_DONGFU);
			if (uiCaveWorld == null) {
				return;
			}
			uiCaveWorld.m_dongfu_yqs_status = yqsStatus;
			uiCaveWorld.m_dongfu_jiaoguang_number = jiaoguangNUm;
			uiCaveWorld.m_dongfu_is_jiaoguang_other = 1;
			if (uiCaveWorld.m_dongfu_yqs_status == 1) {
				uiCaveWorld.actor_yqs.setAction(1, true, true);
			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 2) {
				uiCaveWorld.actor_yqs.setAction(2, true, true);
			}
			else if (uiCaveWorld.m_dongfu_yqs_status == 3) {
				uiCaveWorld.actor_yqs.setAction(0, true, true);
			}

		}
	}

	private ArrayList m_wateringList = new ArrayList(); //浇水人的列表

	/**
	 * 查看浇水人列表
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongFuLookMsgWatering(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); //0：失败 1：成功
		if (status == 1) {
			UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
					.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
			if (uiCaveWorld == null) {
				return;
			}
			uiCaveWorld.m_wateringList.removeAllElements();
			TimeZone tz = TimeZone.getDefault();
			Calendar ca = Calendar.getInstance(tz);

			byte listNum = dis.readByte(); //人员列表数量
			for (int i = 0; i < listNum; i++) {
				SimpleRole role = new SimpleRole();
				String name = dis.readUTF(); //浇水人名字
				long time = dis.readLong() * 1000; //浇水时间   时间差，单位毫秒
				role.m_name = name;
				Date d = new Date(time);
				ca.setTime(d);

				String strMonth = String.valueOf(ca.get(Calendar.MONTH) + 1) + "月";
				String strDate = String.valueOf(ca.get(Calendar.DATE)) + "日";
				String strHour = String.valueOf(ca.get(Calendar.HOUR)) + "时";
				String StrTime = strMonth + strDate + strHour;
				role.m_WateringTime = StrTime;
				uiCaveWorld.m_wateringList.addElement(role);
			}
			uiCaveWorld.DONGFU_UI_CURRENT = uiCaveWorld.DONGFU_UIPEIFANG;
			if (listNum > 0) {
				uiCaveWorld.m_dongfu_peifang_currentindex = 0;
			}
			else {
				uiCaveWorld.m_dongfu_peifang_currentindex = -1;
			}
			uiCaveWorld.m_dongfu_paifang_currentPage = 0;
			uiCaveWorld.m_dongfu_paifang_sumPage = listNum / uiCaveWorld.m_dongfu_paifang_onePage_howLine + 1;
		}
	}

	/**
	 * 发送加速请求返回
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongfuSpeedASK(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); // 0失败 1成功
		if (status == 1) {
			byte type = dis.readByte(); //洞府 工具类型
			int num = dis.readInt(); // 所需money
			UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
					.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
			if (uiCaveWorld == null) {
				return;
			}
			if (type == uiCaveWorld.DONGFU_LABEL_JBP) {
				UIMultiMoney.gotoBuyJiasuWithMoney("聚宝盆加速付费", "可使用元宝立刻完成聚宝盆的聚宝", 0, num, uiCaveWorld.DONGFU_LABEL_JBP);
			}
			else if (type == uiCaveWorld.DONGFU_LABEL_BGL) {
				UIMultiMoney.gotoBuyJiasuWithMoney("八卦炉加速付费", "可使用元宝立刻完成八卦炉的炼制", 0, num, uiCaveWorld.DONGFU_LABEL_BGL);
			}
			else if (type == uiCaveWorld.DONGFU_LABEL_TGF) {
				UIMultiMoney.gotoBuyJiasuWithMoney("天工坊加速付费", "可使用元宝立刻完成天工坊的制造", 0, num, uiCaveWorld.DONGFU_LABEL_TGF);
			}
		}
	}

	/**
	 * 加速使用元宝返回
	 * @param dis
	 * @throws IOException
	 */
	public static void recvDongfuSpeedUPYuanbao(DataInputStream dis) throws IOException
	{
		GameManager.getInstance().m_game_message.unlockNetwork();
		byte status = dis.readByte(); // 状态1 --- 成功，0 ---余额不足， 2---系统忙3 --- 失败
		byte dongfuType = dis.readByte(); //洞府类型
		if (status == 1) {
			UICaveWorldWindow uiCaveWorld = (UICaveWorldWindow) UIManager
					.getInstance().getWindowById(UIWindowFactory.WINDOW_ID_DONGFU);
			if (uiCaveWorld == null) {
				return;
			}
			if (dongfuType == uiCaveWorld.DONGFU_LABEL_JBP) {
				uiCaveWorld.m_dongfu_jbp_status = 2;
			}
			else if (dongfuType == uiCaveWorld.DONGFU_LABEL_BGL) {
				uiCaveWorld.m_dongfu_bgl_status = 2;
			}
			else if (dongfuType == uiCaveWorld.DONGFU_LABEL_TGF) {
				uiCaveWorld.m_dongfu_tgf_status = 2;
			}
		}
		else if (status == 0) {
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "您的余额不足");
		}
		else if (status == 2) {
			GameManager.getInstance().addSystemInfo(GameManager.SYSTEM_INFO_TYPE_B, "系统繁忙");
		}
		else if (status == 3) {

		}
		Tools.debugPrintln("洞府加速放回status：" + status + "dongfuType" + dongfuType);
	}

	private long getADDSpeedPropID(ArrayList list)
	{
		return ((ActorItem) list.elementAt(m_dongfu_peifang_currentindex)).m_guid;

	}

	private String getPeiFangKey(ArrayList list)
	{
		return ((ActorItem) list.elementAt(m_dongfu_peifang_currentindex)).m_key;
	}

	private String getPeiFangName(ArrayList list)
	{
		return ((ActorItem) list.elementAt(m_dongfu_peifang_currentindex)).m_name;
	}

	/**
	 * 初始化图片资源
	 */
	private void initImage()
	{
		img_border_jiao = UIManager.getInstance().coinImage(
				UIManager.RES_BORDER_CORNER);// 选中框
		img_status_yes = UIManager.getInstance().coinImage(
				UIManager.RES_YQS_YES);
		img_status_no = UIManager.getInstance().coinImage(
				UIManager.RES_YQS_NO);
		img_progressBar = GameManager.getInstance().img_casting_bar;
		img_progressBar_w = img_progressBar.getWidth();
		img_progressBar_h = img_progressBar.getHeight();
		img_progressBar_x = (UITools.X_BG + (UITools.W_BG - img_progressBar_w) >> 1);
		anim_yqs = (Animation) (ResourceManager.getInstance().loadResource(
				GameManager.getInstance().m_resource_static, new ResHead(
						ObjectAdapter.RESOURCE_TYPE_ANIM,
						"/anim/df_yaoqianshu.anim", 1)));
		anim_jbp = (Animation) (ResourceManager.getInstance().loadResource(
				GameManager.getInstance().m_resource_static, new ResHead(
						ObjectAdapter.RESOURCE_TYPE_ANIM,
						"/anim/df_jubaopen.anim", 1)));
		anim_bgl = (Animation) (ResourceManager.getInstance().loadResource(
				GameManager.getInstance().m_resource_static, new ResHead(
						ObjectAdapter.RESOURCE_TYPE_ANIM,
						"/anim/df_bagualu.anim", 1)));
		anim_tgf = (Animation) (ResourceManager.getInstance().loadResource(
				GameManager.getInstance().m_resource_static, new ResHead(
						ObjectAdapter.RESOURCE_TYPE_ANIM,
						"/anim/df_tiangongfang.anim", 1)));
		actor_bgl.m_anims = new Animation[1];
		actor_bgl.m_anims[0] = anim_bgl;
		actor_bgl.m_anim = actor_bgl.m_anims[0];
		actor_bgl.setAction(1, true, true);
		actor_bgl.m_posX = (AbstractGameScreen.SCREEN_WIDTH >> 1);
		actor_bgl.m_posY = anim_y;

		actor_tgf.m_anims = new Animation[1];
		actor_tgf.m_anims[0] = anim_tgf;
		actor_tgf.m_anim = actor_tgf.m_anims[0];
		actor_tgf.setAction(1, true, true);
		actor_tgf.m_posX = (AbstractGameScreen.SCREEN_WIDTH >> 1);
		actor_tgf.m_posY = anim_y;

		actor_yqs.m_anims = new Animation[1];
		actor_yqs.m_anims[0] = anim_yqs;
		actor_yqs.m_anim = actor_yqs.m_anims[0];
		actor_yqs.m_posX = (AbstractGameScreen.SCREEN_WIDTH >> 1);
		actor_yqs.m_posY = anim_y;
		actor_yqs.setAction(1, true, true);

		actor_jbp.m_anims = new Animation[1];
		actor_jbp.m_anims[0] = anim_jbp;
		actor_jbp.m_anim = actor_jbp.m_anims[0];
		actor_jbp.m_posX = (AbstractGameScreen.SCREEN_WIDTH >> 1);
		actor_jbp.m_posY = anim_y;

	}

	/////////////////////////////////////////////////////
	// //////////////////////////////////////////////////

	/************************ 绘制 **************************/
	private final int DONGFU_LABEL_PAGE = 3;// 洞府标签显示数量
//	private final int LABEL_BIG_YES = 0;// 标签被按下
//	private final int LABEL_BIG_NO = 1;// 标签没有被按下
//	private final int LABEL_BIG_COUNT = 2;// 标签总数

	public final String[] DONGFU_LABEL = { "摇钱树", "聚宝盆", "八卦炉", "天工坊", "?" };

	public final byte DONGFU_LABEL_YQS = 0; // 摇钱树标签
	public final byte DONGFU_LABEL_JBP = 1; // 聚宝盆
	public final byte DONGFU_LABEL_BGL = 2; // 八卦炉
	public final byte DONGFU_LABEL_TGF = 3; // 天工坊

	private byte m_dongfu_yqs_grade = 1; // 摇钱树等级
	private byte m_dongfu_yqs_gradeMax;
	private byte m_dongfu_jbp_grade = 1; // 聚宝盆等级
	private byte m_dongfu_jbp_gradeMax;
	private byte m_dongfu_bgl_grade = 1; // 八卦炉等级
	private byte m_dongfu_bgl_gradeMax;
	private byte m_dongfu_tgf_grade = 1; // 天工坊等级
	private byte m_dongfu_tgf_gradeMax;

	private short m_dongfu_yqs_over_num = -1;// 当前已经完成次数
	private short m_dongfu_yqs_needOver_num = -1; // 共需完成多少次升级
	private short m_dongfu_jbp_over_num = -1;
	private short m_dongfu_jbp_needOver_num = -1;
	private short m_dongfu_bgl_over_num = -1;
	private short m_dongfu_bgl_needOver_num = -1;
	private short m_dongfu_tgf_over_num = -1;
	private short m_dongfu_tgf_needOver_num = -1;

	private byte m_dongfu_yqs_status = -2; // （摇钱树、聚宝盆、八卦炉、天工坊）状态1.2.3  6为查看
	private byte m_dongfu_jbp_status = -2; // （摇钱树、聚宝盆、八卦炉、天工坊）状态0.1.2
	private byte m_dongfu_bgl_status = -2; // （摇钱树、聚宝盆、八卦炉、天工坊）状态0.1.2
	private byte m_dongfu_tgf_status = -2; // （摇钱树、聚宝盆、八卦炉、天工坊）状态0.1.2

	private byte m_dongfu_jiaoguang_sum = 0; // 摇钱树总共能浇灌次数
	private byte m_dongfu_jiaoguang_number = 0; // 摇钱树s剩余浇灌次数
	private String m_dongfu_key_yqs; // 摇钱树物品的key
	private String m_dongfu_name_yqs; // 摇钱树物品的name
	private short m_dongfu_number_yqs = 0; // 摇钱树物品的数量
	public byte m_dongfu_is_jiaoguang; // 自己是否能浇灌 0不能1能
	private byte m_dongfu_is_jiaoguang_other = 0;//别人的洞府我能否浇灌
	private int m_dongfu_time_jbp_surplus = 0; // 聚宝盆剩余时间
	private int m_dongfu_time_jbp_sum = 0;// 聚宝盆共需时间
	private short m_dongfu_jbp_multiple = 0; // 聚宝正常生产的倍数
	private short m_dongfu_jbp_current_multiple = 0; // 当前生产的倍数
	private String m_dongfu_key_jbp; // 聚宝物品的key
	private String m_dongfu_name_jbp; // 聚宝物品的name
	// private int m_dongfu_number_jbp = 0; //聚宝物品的数量
	private int m_dongfu_time_bgl_surplus = 0; // 八卦炉剩余时间
	private int m_dongfu_time_bgl_sum = 0;// 八卦炉共需时间
	private String m_dongfu_key_bgl; // 八卦炉祭炼物品的key
	private String m_dongfu_name_bgl; // 八卦炉祭炼物品的name
	private int m_dongfu_number_bgl = 0; // 八卦炉祭物品的数量
	private int m_dongfu_time_tgf_surplus = 0; // 天工坊剩余时间
	private int m_dongfu_time_tgf_sum = 0;// 天工坊共需时间
	private String m_dongfu_key_tgf; // 天工坊生产物品的key
	private String m_dongfu_name_tgf; // 天工坊生产物品的name
	private int m_dongfu_number_tgf = 0; // 天工坊生产物品的数量
	private byte m_dongfu_label_currentindex = 0;// 当前选项标签
	private final String[][] DONGFU_LABEL_STRING = {
			{ "", "2.浇灌", "2.收获", "已收获", "已浇灌", "1.查看", "3.好友" }, { "2.投入", "2.加速", "2.收取", "1.查看", "3.攻伐" },
			{ "2.祭练", "2.加速", "2.开炉" }, { "2.开工", "2.加速", "2.收取" } };
	private final String[][] DONGFU_UP_MSG = { { "级摇钱树，每天产生", "张银票" },
			{ "级聚宝盆，最多产生", "倍宝物", "可获得" }, { "级八卦炉，可炼制", "级秘方", "正在炼制", },
			{ "级天工坊，可制造", "级天工图", "正在制造" } };
//	private final String[] DONGFU_MIDDLE_MSG = { "再收获", "次就可以升至", "级" };
	private final String[][] DONGFU_DOWN_MSG = {
			{ "点击按钮可浇灌摇钱树", "点击按钮可浇灌摇钱树", "可收取摇钱树结出的银票", "明日才可再次浇灌摇钱树",
					"已浇灌，等待其他好友浇灌" },
			{ "可向聚宝盆中投入宝物", "聚宝剩余时间： ", "可收取聚宝盆中的宝物了", "保护时间 " },
			{ "可在炉中炼制药物符咒", "剩余时间： ", "炼制完成" },
			{ "可在坊中打造武器装备", "剩余时间： ", "打造完成" } };

	//#if screen == "640360"
	 private final int m_background_fill_w = UITools.W_BG-UITools.INITX_CONTENT*2; // 背景宽
	 private final int m_background_fill_h = 230;// 背景高
	//#else
//	private final int m_background_fill_w = UITools.W_BG - UITools.INITX_CONTENT * 2; // 背景宽
//	private final int m_background_fill_h = 210;// 背景高
	//#endif

	private final int m_background_fill_x = UITools.X_BG + ((UITools.W_BG - m_background_fill_w) >> 1);
	private final int m_background_fill_y = UITools.Y_BG + UITools.INITY_CONTENT + 22;
	private final int DONGFU_UIMAIN = 0; // 洞府主界面
	private final int DONGFU_UIPEIFANG = 1; // 洞府配方界面
	private final int DONGFU_UISTUFF = 2; // 洞府材料界面
//	private final int DONGFU_UISTART = 3; // 确定生产界面
	private final int DONGFU_UIADDSPEED = 4; // 加速道具界面
	private int DONGFU_UI_CURRENT = 0; // 当前界面
	// 配方
	private final int DONGFU_UIPEIFANG_W = 183;
	private final int DONGFU_UIPEIFANG_H = 23;
	private final int DONGFU_UIPEIFANG_X = UITools.X_BG + ((UITools.W_BG - DONGFU_UIPEIFANG_W) >> 1);
	private final int DONGFU_UIPEIFANG_Y = UITools.Y_BG + UITools.INITY_CONTENT + UITools.H_LABEL + 2;

	private final int DONGFU_UIPEIFANG_FREAM_W = 183;
	//#if screen == "320240"
	//# private final int DONGFU_UIPEIFANG_FREAM_H = UITools.H_RECT - (UITools.H_LABEL + DONGFU_UIPEIFANG_H + UITools.IW_WIN) - (AbstractGameScreen.FONT_H);
	//#else
	private final int DONGFU_UIPEIFANG_FREAM_H = UITools.H_RECT
			- (UITools.H_LABEL + DONGFU_UIPEIFANG_H + UITools.IW_WIN);
	//#endif
	private final int DONGFU_UIPEIFANG_FREAM_X = UITools.X_BG + ((UITools.W_BG - DONGFU_UIPEIFANG_FREAM_W) >> 1);
	private final int DONGFU_UIPEIFANG_FREAM_Y = DONGFU_UIPEIFANG_Y + DONGFU_UIPEIFANG_H;

	///////////////////////////////////////////////////
//	private int LABEL_CHANGE1_X = (((AbstractGameScreen.SCREEN_WIDTH - UITools.W_BUTTON_BIG) >> 1) - UITools.W_BUTTON_BIG);//*#
//	private int LABEL_CHANGE2_X = (((AbstractGameScreen.SCREEN_WIDTH + UITools.W_BUTTON_BIG) >> 1) + UITools.W_BUTTON_BIG);
	private int FRAME_ANIM_W = 118;
	private int FRAME_ANIM_H = 118;
	private int FRAME_ANIM_X = UITools.X_BG + ((UITools.W_BG - FRAME_ANIM_W) >> 1); //动画的外框
	private int FRAME_ANIM_Y = UITools.Y_BG + UITools.INITY_CONTENT + 58;

	private final int Y_MIDDLE_LABEL = UITools.Y_BG + UITools.INITY_CONTENT + 176; // 中间标签坐标
	private final int X_MIDDLE_LABEL = (UITools.X_BG + (UITools.W_BG >> 1) - (UITools.W_LABEL_BIG >> 1));// 中间标签坐标
	private final int MIDDLE_LABEL1_X = UITools.X_BG + (UITools.W_BG - UITools.W_LABEL_BIG * 3) / 4;
	private final int MIDDLE_LABEL2_X = UITools.X_BG + (UITools.W_BG - UITools.W_LABEL_BIG * 3) * 2 / 4
			+ UITools.W_LABEL_BIG;
	private final int MIDDLE_LABEL3_X = UITools.X_BG + (UITools.W_BG - UITools.W_LABEL_BIG * 3) * 3 / 4
			+ UITools.W_LABEL_BIG * 2;

	private int m_dongfu_peifang_currentindex = -1; // 配方列表下标
	private int m_dongfu_paifang_currentPage = 0;
	private int m_dongfu_paifang_sumPage = 1;
	private ArrayList m_dongfu_yqs_peifang_list = new ArrayList(); // 摇钱树 帮忙好友list
	private ArrayList m_dongfu_bgl_peifang_list = new ArrayList(); // 八卦炉配方列表
	private ArrayList m_dongfu_tgf_peifang_list = new ArrayList();
	private ArrayList m_dongfu_jbp_peifang_list = new ArrayList();
	private ArrayList m_dongfu_add_speedList = new ArrayList(); // 加速道具列表
	private final int LIST_RECT_H = AbstractGameScreen.FONT_H + 8; // 一行高
	private final int UP_ONELINE_STRING_Y = UITools.Y_BG + UITools.INITY_CONTENT + 28; // 第一行字
	private final int MIDDLE_ONELINE_STRING_Y = UITools.Y_BG + UITools.INITY_CONTENT + 41; // 第二行字
	private final int DOWN_STRING_Y = UITools.Y_BG + UITools.INITY_CONTENT + 214; // 下方的提示文字

	private final int m_dongfu_paifang_onePage_howLine = DONGFU_UIPEIFANG_FREAM_H / LIST_RECT_H;
	// //////////////////////////////////////////////////
	public final int STATUS_MONEY_TREE = 0;// 摇钱树
	public final int STATUS_AGATE = 1;// 聚宝盆
	public final int STATUS_EIGHT_TRIGRAMS = 2;// 八卦炉
	public final int STATUS_WORKSHOP = 3;// 天工坊
	/******************* 图片 *********************/
	private Image img_border_jiao = null; // 选中框

	private Image img_status_yes = null; // 摇钱树已经浇灌的
	private Image img_status_no = null; // 摇钱树没有浇灌的
	private Image img_progressBar = null; // 计时条
	private int img_progressBar_x; // 计时条
	private int img_progressBar_y = UITools.Y_BG + UITools.INITY_CONTENT + 206;
	private int img_progressBar_w; // 计时条
	private int img_progressBar_h; // 计时条
	private int YQS_JIAOGUANG_LABEL_Y = UITools.Y_BG + UITools.INITY_CONTENT + 201; // 摇钱树浇灌次数显示图片Y
	private Animation anim_yqs;// 摇钱树动画
	private Animation anim_jbp;
	private Animation anim_bgl; // 八卦炉动画
	private Animation anim_tgf;
	private Actor actor_bgl = new Actor();// 八卦炉ACTOR类
	private Actor actor_tgf = new Actor();// 天工坊炉ACTOR类
	private Actor actor_yqs = new Actor(); //摇钱树   actor类
	private Actor actor_jbp = new Actor(); //八卦炉 Actor 类 
	private int anim_y = UITools.Y_BG + UITools.INITY_CONTENT + 156;

	private long m_currentDongFuPlayerID; // 当前洞府玩家的ID
	public long m_currentDongFuID; // 当前洞府ID
	/////////////////////////////////////
	private final int DONGFUSTUFF_MAXNUM_W = AbstractGameScreen.FONT_H + 4;
	private final int DONGFUSTUFF_MAXNUM_H = 16;
	private final int DONGFUSTUFF_MAXNUM_Y = UITools.X_BG + UITools.INITY_CONTENT + UITools.H_RECT
			- DONGFUSTUFF_MAXNUM_W - UITools.IW_WIN; // 选择制造个数的显示
	private final int DONGFUSTUFF_MAXNUM_X = UITools.X_BG + (UITools.W_BG >> 1); // 选择制造数的显示
	private int m_need_prodction = 1; // 需要制造几个
	private int m_max_prodctionNum; // 最多制造几个
	///////////////////////////////////////////////
	private ArrayList m_dongfu_need_Prop = new ArrayList(); // 需要的材料列表
	private ArrayList m_dongfu_get_Prop = new ArrayList(); // 获得的道具
	private int m_getPropMultiple; // 聚宝盆获得道具的倍数
	private int m_need_vim; // 需要的精力
//	private int m_sum_vim = 180;
	private int m_need_gread; // 需要的等级

	private int m_peifang_num = (DONGFU_UIPEIFANG_FREAM_H - 2 - LIST_RECT_H * 2 - DONGFUSTUFF_MAXNUM_W) / LIST_RECT_H;
	private int m_peifangstart_num = (DONGFU_UIPEIFANG_FREAM_H - 2 - LIST_RECT_H * 3) / LIST_RECT_H;

	private int m_peifang_currentpage = 0;

	public boolean m_StuffIsEnough; //配方所需材料是否齐全

	private String m_GongFa1 = "洞府被\"";
	private String m_GongFa2 = "\"侵入，守护神兽成功击退了敌人";
	private String m_GongFa3 = "\"侵入，守护神兽未能阻止敌人，损失：";
	private String m_GongFa4 = "|";
	private StringBuffer m_GongFaMsg;
	private String[] m_GongFaMsgStringList;
	private int m_gongfaMsg_num = (DONGFU_UIPEIFANG_FREAM_H - UITools.IW_WIN) / LIST_RECT_H; //可显示的行数
	private int m_dongfuMsg_W = DONGFU_UIPEIFANG_FREAM_W - UITools.IW_WIN;
	private int m_index_DongFuGongfaList;

	//
	private ArrayList m_openDongFuLable = new ArrayList();//洞府 已开工具
	private int m_openDongFuLableNUm;

	protected void registerTouch() {
		clearAllRects();
		registerNormalSoft();
		
		initTouchRect(new int[][]{
				{166,38,48,20},
				{216,38,48,20},
				{266,38,48,20},
				///
				{89,215,48,20},
				{216,215,48,20},
				{342,215,48,20},
		});
	}

	protected void onTouchRect(int[][] rect, int touchid) {
		switch(touchid) {
		case 0:
		case 1:
		case 2:
			if (touchid < (m_openDongFuLableNUm - 1)) {
//			if (m_dongfu_label_currentindex == (byte) touchid) {
//				GameTouchManager.keyPressedFire();
//			} else {
				m_dongfu_label_currentindex = (byte) touchid;
			}
			break;
		case 3:
			GameTouchManager.keyPressedNum(1);
			break;
		case 4:
			GameTouchManager.keyPressedNum(2);
			break;
		case 5:
			GameTouchManager.keyPressedNum(3);
			break;
		}
	}

	
}
